bytes to str, str to bytes :param object: :return:
(object)
| 429 | time.sleep(interval) |
| 430 | |
| 431 | def byte_str(object): |
| 432 | ''' |
| 433 | bytes to str, str to bytes |
| 434 | :param object: |
| 435 | :return: |
| 436 | ''' |
| 437 | if isinstance(object, str): |
| 438 | return object.encode(encoding="utf-8") |
| 439 | elif isinstance(object, bytes): |
| 440 | return bytes.decode(object) |
| 441 | else: |
| 442 | print(type(object)) |
| 443 | |
| 444 | if __name__ == '__main__': |
| 445 | for argc in sys.argv: |