python怎么查看字符串编码
展开全部
安装chardet模块
chardet文件夹放在/usr/lib/python2.4/site-packages目录下
[root@sha-sso-data01 chardet]# python
Python 2.4.3 (#1, Sep 21 2011, 19:55:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import chardet
>>> chardet.detect("我")
{'confidence': 0.505, 'encoding': 'utf-8'}
>>>
chardet文件夹放在/usr/lib/python2.4/site-packages目录下
[root@sha-sso-data01 chardet]# python
Python 2.4.3 (#1, Sep 21 2011, 19:55:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import chardet
>>> chardet.detect("我")
{'confidence': 0.505, 'encoding': 'utf-8'}
>>>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询