运维网's Archiver
论坛
›
Python
› python抓网页中文乱码问题
13719654321
发表于 2017-5-4 11:19:42
python抓网页中文乱码问题
import urllib2
import sys
content = urllib2.urlopen("http://www.higis.cn").read() #网站页面是utf-8编码的。
type = sys.getfilesystemencoding() # 关键
print content.decode("UTF-8").encode(type)# 关键
页:
[1]
查看完整版本:
python抓网页中文乱码问题