爬虫提交form表单中含有(unable to decode value)解决方法
文章目录
在一次抓取网站的过程中,使用chrome调试时,发现一个参数为:(unable to decode value),经过多方尝试,发现是网页编码问题,在返回的网页源代码中可以看到该网站编码为GBK,
content="text/html;charset=GBK"
这里只需要使用python的encode方法将编码转换即可
company_name = "科技有限公司"
company_name = company_name.encode("GBK")
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论