問題
requests
返回的數(shù)據(jù)中碱呼,中文出現(xiàn)亂碼
image
decode
報(bào)錯,
AttributeError: 'str' object has no attribute 'decode'
encode
也無法解碼顯示正確的字符御雕。
解決
req = requests.get(url, headers=headers)
html=req.content
html_doc=str(html,'utf-8')
requests
返回的數(shù)據(jù)中碱呼,中文出現(xiàn)亂碼
decode
報(bào)錯,
AttributeError: 'str' object has no attribute 'decode'
encode
也無法解碼顯示正確的字符御雕。
req = requests.get(url, headers=headers)
html=req.content
html_doc=str(html,'utf-8')