问题
requests
返回的数据中,中文出现乱码
decode
报错,
AttributeError: 'str' object has no attribute 'decode'
encode
也无法解码显示正确的字符。
解决
req = requests.get(url, headers=headers)
html=req.content
html_doc=str(html,'utf-8')
requests
返回的数据中,中文出现乱码
decode
报错,
AttributeError: 'str' object has no attribute 'decode'
encode
也无法解码显示正确的字符。
req = requests.get(url, headers=headers)
html=req.content
html_doc=str(html,'utf-8')