需求
使用BeautifulSoup解析网页获取图片地址,使用html.parser框架解析。
html.parser解析
soup = BeautifulSoup(response.text, 'html.parser')
本来8张图片,html.parser解析结果是出现了重复图片地址

第7张和第8张重复

lxml解析
soup = BeautifulSoup(response.text, 'lxml')
lxml解析正常,8张图片

当前文章价值8.2元,扫一扫支付后添加微信提供帮助!(如不能解决您的问题,可以申请退款)

你可能感兴趣的文章
分类:python
标签:BeautifulSoup, html.parser
评论已关闭!