python如何判断字符串编码方式
python判断字符串编码方式的方法:1、打开命令提示符,进入python27\Script目录;2、执行命令安装chardet;3、判断字符串编码方式即可,如:【chardet.detect(f.read())】。
具体方法:
(推荐教程:python入门教程)
1、安装chardet
在命令行中,进入python27\Scripts目录,执行以下命令
easy_installchardet
2、判断方法
importchardet f=open('file','r') fencoding=chardet.detect(f.read()) printfencoding
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。