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")
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/16785.html