The Dormouse"s story
Once upon a time there were three little sisters; and their names were
Lacie and
and they lived at the bottom of a well.
...
"""使用BeautifulSoup解析这段代码,能够得到一个 BeautifulSoup 的对象,并能按照标准的缩进格式的结构输出:
soup = BeautifulSoup(html,"lxml")print("***"*10)print(soup.prettify())
输出结果
The Dormouse"s storyThe Dormouse"s story
Once upon a time there were three little sisters; and their names wereElsie,LacieandTillie;
and they lived at the bottom of a well.
...