编码 -- encode
(1) 不同编码之间的二进制是不能互相识别的
(2) 在python 2X str内存编码方式(内存)为unicode
但是,对于文件的存储,和传输不能用unicode
bytes类型:内存编码方式(非unicode)
unicode 转化 bytes
s = 'laonanhai' #str -->bytes encode编码
s2 = s.encode('utf-8')
print(s2)
#bytes --->str decode解码
posted on 2018-04-10 14:42 python21-李伟 阅读(144) 评论(0) 编辑 收藏 举报