字符串转二进制用decode
二进制转字符串用encode
举例:
msg="hello 世界你好"
print(msg)
print(msg.encode("utf-8"))
print(msg.encode("utf-8").decode("utf-8"))
字符串转二进制用decode
二进制转字符串用encode
举例:
msg="hello 世界你好"
print(msg)
print(msg.encode("utf-8"))
print(msg.encode("utf-8").decode("utf-8"))