python字符编码
python3默认unicode 所以操作起来更加的方便,可以直接编码 msg = '你好,世界' # python3 print(msg) print(msg.encode('utf-8')) print(msg.encode('euc-jp')) print(msg.encode('utf-8').decode('utf-8').encode('gb2312')) ''' python2 msg_gbk = msg.decode('utf-8).encode('gbk') print(msg_gbk) 来源: https://www.cnblogs.com/lcxiao/p/11386515.html