字符串编码 解码

python的内核 使用的是unicode 编码

encode 和 decode

 a = '中国'.encode(encoding = 'gbk')    编码
 a
 :b'\xd6\xd0\xb9\xfa'


b = a.decode(encoding = 'gbk')            解码

 b
: '中国'
 

猜你喜欢

转载自blog.csdn.net/qq_41646730/article/details/80681705