Python/BeautifulSoup - how to remove all tags from an element?

后端 未结 7 1597
执念已碎
执念已碎 2020-11-28 06:01

How can I simply strip all tags from an element I find in BeautifulSoup?

7条回答
  •  被撕碎了的回忆
    2020-11-28 06:32

    it looks like this is the way to do! as simple as that

    with this line you are joining together the all text parts within the current element

    ''.join(htmlelement.find(text=True))
    

提交回复
热议问题