您将需要为此使用beautifulsoup的unwrap()。
import bs4soup1 = bs4.BeautifulSoup(htm1, 'html.parser')for match in soup1.findAll('span'): match.unwrap()print soup1
您将需要为此使用beautifulsoup的unwrap()。
import bs4soup1 = bs4.BeautifulSoup(htm1, 'html.parser')for match in soup1.findAll('span'): match.unwrap()print soup1