python3 requests请求response.text返回\u 16进制数字,转换中文

返回\u 16进制数字

reponse.content.decode("unicode_escape")

返回乱码中文

获取网站原始编码
print(requests.utils.get_encodings_from_content(r.text)[0])
设置编码: r.encoding= requests.utils.get_encodings_from_content(r.text)[0]
打印: print(r.text)

猜你喜欢

转载自blog.51cto.com/sonlich/2316984