蟒蛇/ BeautifulSoup - 如何从一个元素中删除所有的标签? [英] Python/BeautifulSoup - how to remove all tags from an element?
本文介绍了蟒蛇/ BeautifulSoup - 如何从一个元素中删除所有的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能简单地从一个元素我BeautifulSoup找到去除所有标签?
how can I simply strip all tags from an element I find in BeautifulSoup ?
推荐答案
通过 BeautifulStoneSoup
在 BS4
走了,这是即使在Python3简单
With BeautifulStoneSoup
gone in bs4
, it's even simpler in Python3
from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
text = soup.getText()
print(text)
这篇关于蟒蛇/ BeautifulSoup - 如何从一个元素中删除所有的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文