from bs4 import BeautifulSoup html = """ Hello world! """ soup = BeautifulSoup(html, "html.parser") if soup is not None: print(soup.find("div", {"id": "test"}).text) else: print("Soup is None.")
上一篇:beautifulsoup在网站上没有显示所有的元素
下一篇:BeautifulSoup在XML文档中添加/插入HTML标签行