import requests response = requests.post('https://www.suimeng.com/modules/article/search.php?searchkey={}'.format('全球高武')) print('status_code:',response.status_code) if response.status_code == 200: #response.encoding = 'utf-8' print
response = requests.post('https://www.suimeng.com/modules/article/search.php?searchkey={}'.format('全球高武'))
print('status_code:',response.status_code)
if response.status_code == 200:
#response.encoding = 'utf-8'
print('response.headers:',response.headers)
print(response.encoding)
key = 'Content-Encoding'
# print(response.headers[key])
print("-----------")
# if(key in response.headers and response.headers['Content-Encoding'] == 'br'):
# data = brotli.decompress(response.content)
# data1 = data.decode('gbk')
# print(data1)
# print('response.text:',response.text)
print(response.content.decode('gbk'))
设置编码格式response.content.decode(‘gbk’)