from bs4 import BeautifulSoup
html_doc = """
<!DOCTYPE html>
<html lang="en">
<head>
<title>bs4演示</title>
</head>
<body>
<p class="title"><b>省委书记等观看“老虎”受审画面</b></p>
<p class="story">乌克兰首都上空现巨大光球</p>
<p>
<a href="https://www.baidu.com" class="sister" id="baidu">百度一下</a><br />
<a href="https://www.jd.com" class="sister box" id="jd">京东购物</a><br />
<a href="https://www.sina.com.cn" class="sister" id="sina">新浪网</a><br />
</p>
<span>女子晒衣服不慎10楼跌落悬挂2楼</span>
<p class="story">泰国将为熊猫赔付1500万泰铢</p>
</body>
</html>
"""
# html_doc
# 1.创建bs4
soup = BeautifulSoup(html_doc, "lxml")
# print(type(soup)) # <class 'bs4.BeautifulSoup'>
# print(soup)
from bs4 import BeautifulSoup
html_doc = """
<!DOCTYPE html>
<html lang="en">
<head>
<title>bs4演示</title>
</head>
<body>
<p class="title"><b>省委书记等观看“老虎”受审画面</b></p>
<p class="story">乌克兰首都上空现巨大光球</p>
<p>
<a href="https://www.baidu.com" class="sister" id="baidu">百度一下</a><br />
<a href="https://www.jd.com" class="sister box" id="jd">京东购物</a><br />
<a href="https://www.sina.com.cn" class="sister" id="sina">新浪网</a><br />
</p>
<span>女子晒衣服不慎10楼跌落悬挂2楼</span>
<p class="story">泰国将为熊猫赔付1500万泰铢</p>
</body>
</html>
"""
# html_doc
# 1.创建bs4
soup = BeautifulSoup(html_doc, "lxml")
# print(type(soup)) # <class 'bs4.BeautifulSoup'>
# print(soup)