python编码

1、查看python中字符或参数的编码

安装chardet模块

chardet文件夹放在site-packages目录下

>>> import chardet
>>> chardet.detect("string")
2、
#编码转换过程:原有编码——内部编码——目的编码
#decode:把原有编码转换成unicode
#encode:把unicode编码转换成其他编码的字符串
#u:把。。转换成unicode,u'nihao'
posted @ 2016-05-30 17:23  萱娃  阅读(152)  评论(0编辑  收藏  举报