Beautiful Soup 是一个用来从HTML或XML文件中提取数据的Python库,它利用大家所喜欢的解析器提供了许多惯用方法用来对文档树进行导航、查找和修改。
帮助文档英文版:https:///tillie" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" id="link3">Tillie</a>] # 返回字符串soup.find_all(text=["Tillie", "Elsie", "Lacie"]) # 返回前两个 a 标签soup.find_all("a", limit=2) # 返回 title 标签,不级联查询soup.html.find_all("title", recursive=False) # 使用 CSS 选择器进行过滤soup.select("head > title") # 传入正则表达式,根据标签名称查找匹配(以字母 b 开头)标签f