python chardet模块 检测文档编码
2017-01-01 22:25
453 查看
python chardet模块 检测文档编码
想知道文档、网页的编码,可以使用python的chardet模块,如下:
import chardet
import urllib2
theresult = urllib2.urlopen(url = 'www.baidu.com').read()
print chardet.detect(theresult)
输出结果 {'confidence': 0.99, 'encoding': 'GB2312'}
意思是网页编码有99%的可能性是gb2312
想知道文档、网页的编码,可以使用python的chardet模块,如下:
import chardet
import urllib2
theresult = urllib2.urlopen(url = 'www.baidu.com').read()
print chardet.detect(theresult)
输出结果 {'confidence': 0.99, 'encoding': 'GB2312'}
意思是网页编码有99%的可能性是gb2312
相关文章推荐
- python编码检测模块chardet
- python2.7:文件编码检测chardet 详解
- Python之动态检测编码chardet
- python3下的编码检测——chardet
- [Python模块学习]chardet模块识别字节包编码
- Python基础 检测多种语言编码 chardet
- Python-模块和包.运维开发中chartdet编码检测的最佳实践
- 【教程】如何用Python中的chardet去检测字符编码类型
- Python编码检测 chardet 效果不如 UnicodeDammit
- python3下的编码检测——chardet
- python字符串编码识别模块chardet简单应用
- python chardet模块查看编码
- Python使用chardet包自动检测编码
- python 查看文档编码格式-chardet
- python模块使用之chardet, 判断字符串编码
- Python使用chardet包自动检测编码
- Python中动态检测编码chardet的使用教程
- 基础入门_Python-模块和包.运维开发中chartdet编码检测的最佳实践?
- 【整理】Python的字符编码检测库:charade和chardet的区别
- python字符串编码识别模块chardet简单应用