问题
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')
本文标题:Python 中文乱码问题
本文链接:https://www.haomeiwen.com/subject/ayhcxktx.html
网友评论