python编码问题

requests下返回结果为unicode编码,需要转换为中文可以如下命令:

response = requests.post('https://xxx.com/', headers=headers, params=params, cookies=cookies, data=data, verify=False)
response1 = response.text
new=response1.encode('latin-1').decode('unicode_escape')
print(new)

如果返回结果为url编码,需要转换为中文为如下

print(urllib.request.unquote(response.text))