import io
#
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
#方式1
response = requests.get(self.url, headers=self.head)
bm = response.encoding
#获取网页编码
html = response.text
html = html.encode(bm) # 用网页编码 解码
html = BeautifulSoup(html, 'lxml')
#方式2
response.encoding = response.apparent_encoding
html = BeautifulSoup(response.text,'lxml')