bytes to str, str to bytes :param object: :return:
(object)
| 397 | |
| 398 | |
| 399 | def byte_str(object): |
| 400 | ''' |
| 401 | bytes to str, str to bytes |
| 402 | :param object: |
| 403 | :return: |
| 404 | ''' |
| 405 | if isinstance(object, str): |
| 406 | return object.encode(encoding="utf-8") |
| 407 | elif isinstance(object, bytes): |
| 408 | return bytes.decode(object) |
| 409 | else: |
| 410 | print(type(object)) |
| 411 | |
| 412 | if __name__ == '__main__': |
| 413 | for argc in sys.argv: |