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、打开Python3.7交互界面
2、定义字符串变量str = 'this is a encode and decode test'
3、用encode()方法进行GBK编码newStr = str.encode('GBK')
4、打印输出
5、同时我可以对newStr进行解码newStr.decode('AsCII')