首页 > 编程语言 > 详细

Python3.x:BeautifulSoup()解析网页内容出现乱码

时间:2018-01-14 20:39:13      阅读:603      评论:0      收藏:0      [点我收藏+]

Python3.x:BeautifulSoup()解析网页内容出现乱码

问题:

start_html = requests.get(all_url, headers=Hostreferer)
BeautifulSoup(start_html.text, "html.parser")

 出现乱码; 

解决方案:

 将BeautifulSoup(start_html.text, "html.parser")替换为BeautifulSoup(start_html.content, "html.parser"),即可;

start_html = requests.get(all_url, headers=Hostreferer)
BeautifulSoup(start_html.content, "html.parser")

 

Python3.x:BeautifulSoup()解析网页内容出现乱码

原文:https://www.cnblogs.com/lizm166/p/8284131.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!