
正文
Python3.x:BeautifulSoup()解析网页内容出现乱码
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
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")







