首页 > 应用开发 > Python > Python爬虫中文乱码的问题(设置Accept-Encoding参数)
初识Python爬虫的时候我们可能会去爬一个页面,但是在初始爬虫的时候会看到中文乱码。
headers = { "User-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 Edg/89.0.774.54", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-US,q=0.7", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive" }
后来 检查后发现问题在 Accept-Encoding 中,将默认其中的br去掉,就可以实现。
转载于:https://www.itbulu.com/accept-encoding.html
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31380193/viewspace-3017279/ ,如需转载,请注明出处,否则将追究法律责任。
注册时间:2016-08-01