摘要: 最近利用python抓取一些网上的数据,遇到了编码的问题。非常头痛,总结一下用到的解决方案。 linux中vim下查看文件编码的命令 set fileencoding python中一个强力的编码检测包 chardet ,使用方法非常简单。linux下利用pip install chardet实现简单安装 import chardetf = open('file','r')fencoding=chardet.detect(f.read())print fencoding fencoding输出格式{'confidence': 0.96630842 阅读全文
posted @ 2014-02-15 16:43 weixliu 阅读(14609) 评论(3) 推荐(0) 编辑