python----encode和decode的区别

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

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

  

posted @ 2018-11-06 17:00  小名的同学  阅读(297)  评论(0编辑  收藏  举报