前言
beautfifulsoup是python中解析html结构的工具包,使用起来极其方便。本文介绍如何使用beautfifulsoup来获取html里的内容。
获取批量标签
如获取所有h3
items = bs.find_all("h3")
获取父级标签
item2 = item1.parent
beautfifulsoup是python中解析html结构的工具包,使用起来极其方便。本文介绍如何使用beautfifulsoup来获取html里的内容。
如获取所有h3
items = bs.find_all("h3")
item2 = item1.parent