from bs4 import BeautifulSoup
soup = BeautifulSoup(content, ‘html.parser‘)
overview = soup.text[0:9]
print(overview)
from bs4 import BeautifulSoup
soup = BeautifulSoup(content, ‘html.parser‘)
print(soup) # 这里带有script标签的脚本
for tag in soup.find_all():
if tag.name in [‘script‘, ‘link‘]:
tag.decompose()
print(soup) # 这里已经把带有script标签的脚本去掉了