python----encode和decode的区别

a = 'ddd'.encode("utf8")
print(type(a)) # <class 'bytes'>
字符串变成字节

a = b'ddd'.decode('utf-8')
print(type(a)) #<class 'str'>
字节变成字符串

  

原文地址:https://www.cnblogs.com/yanxiaoge/p/9916367.html