解决爬虫网页内容乱码问题

import requests
response=requests.get('https://www.baidu.com')
print(response.text)   # 中文为乱码
print(response.content.decode('utf-8'))  # 中文正常显示

猜你喜欢

转载自www.cnblogs.com/reyinever/p/10855210.html