from bs4 import BeautifulSoup
soup = BeautifulSoup(content, 'html.parser') # content为获取的用户上传内容
tags = soup.find_all()
for tag in tags:
if tag.name == 'script':
tag.decompose()
content = str(soup)
from bs4 import BeautifulSoup
soup = BeautifulSoup(content, 'html.parser') # content为获取的用户上传内容
tags = soup.find_all()
for tag in tags:
if tag.name == 'script':
tag.decompose()
content = str(soup)