1、查找网页utf编码
import urllib
if name == 'main' :
req = urllib.urlopen('自己想查看的网址')
html = req.read()
dehtml = html.decode('utf-8')
print dehtml
2、自动获取网页编码
安装 chardet
python -m pip install chardet
import urllib
import chardet
if name == 'main' :
req = urllib.urlopen('自己想查看的网址')
html=req.read()
charset = chardet.detect(html)
print req.getcode()
print charset