python学习BeautifulSoup解析框架html

2024-03-15 21:44 python学习BeautifulSoup解析框架html已关闭评论

需求

使用BeautifulSoup解析网页获取图片地址,使用html.parser框架解析。

html.parser解析

soup = BeautifulSoup(response.text, 'html.parser')

本来8张图片,html.parser解析结果是出现了重复图片地址

第7张和第8张重复

lxml解析

soup = BeautifulSoup(response.text, 'lxml')

lxml解析正常,8张图片

你可能感兴趣的文章

来源:每日教程每日一例,深入学习实用技术教程,关注公众号TeachCourse
转载请注明出处: https://teachcourse.cn/3142.html ,谢谢支持!

资源分享

分类:python 标签:,
harmony学习组件(@Component)生命周期 harmony学习组件(@Component)生
三级缓存的含义和如何实战使用? 三级缓存的含义和如何实战使用?
Docker Compose 编排实战 Docker Compose 编排实战
python项目重命名后虚拟环境报错 python项目重命名后虚拟环境报错

评论已关闭!