1、在python2里,默认编码是ASCII,python3里默认是UTF-8

2、unicode分为utf-32(占4个字节),utf-16(占两个字节),utf-8(占1-4个字节),所以,utf-8就是unicode

3、在python3中encode,在转码的同时还会把string变成bytes类型,decode在解码的同时还会把bytes变回string

在python2里:  

 

在python3里:

 

posted on 2016-12-07 15:27  自然洒脱  阅读(171)  评论(0编辑  收藏  举报