beautifulsoup 解析html库


beautifulsoup 解析html库

https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/

html_doc = """
The Dormouse's story

The Dormouse's story

Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.

...

""" from bs4 import BeautifulSoup soup = BeautifulSoup(html_doc, 'html.parser') print(soup.title.string) print(soup.prettify()) print(soup.p) print(soup.p['class']) print(soup.find(id="link3"))