您将需要为此使用beautifulsoup的unwrap()。
import bs4
soup1 = bs4.BeautifulSoup(htm1, 'html.parser')
for match in soup1.findAll('span'):
match.unwrap()
print soup1
从BeautifulSoup / Python中删除跨度标签
您将需要为此使用beautifulsoup的unwrap()。
import bs4
soup1 = bs4.BeautifulSoup(htm1, 'html.parser')
for match in soup1.findAll('span'):
match.unwrap()
print soup1