python基础:字符串编码与解码
1、打开Python3.7交互界面

2、定义字符串变量
str = 'this is a encode and decode test'

3、用encode()方法进行GBK编码
newStr = str.encode('GBK')

4、打印输出

5、同时我可以对newStr进行解码
newStr.decode('AsCII')

1、1.encode()进行编码
2.decode()进行解码
3.编解码尽量保持一致
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:81
阅读量:50
阅读量:154
阅读量:36
阅读量:112