python3.5解析网页之后,汉字成了乱码,解决方法如下:
#加上一个编码方法
html.encoding = html.apparent_encoding
例:
import requests
from bs4 import BeautifulSoup
html = requests.get('http://www.baidu.com')
html.encoding = html.apperent_encoding
soup = BeautifulSoup(html.text, 'lxml')