Parsing 使用BeautifulSoup移除del标签

Parsing 使用BeautifulSoup移除del标签,parsing,python-3.x,beautifulsoup,Parsing,Python 3.x,Beautifulsoup,我对BeautifulSoup和Python3有点愚蠢的问题。这是我的HTML: <span id="gaixm--1521602--15686128--ADHP.GEO_LONG" Visibility="None"> <del class="cellChanged NO_REVISION_MARK AmdtDeletedAIRAC" title="Date d'entrée en vigueur: 17 SEP 2015. " id="geaip_4b6c6

我对BeautifulSoup和Python3有点愚蠢的问题。这是我的HTML:

<span id="gaixm--1521602--15686128--ADHP.GEO_LONG" Visibility="None">
        <del class="cellChanged NO_REVISION_MARK AmdtDeletedAIRAC" title="Date d'entrée en vigueur: 17 SEP 2015. " id="geaip_4b6c6e3f-9841-400c-9359-6ae9b334448d">001°49'57"E</del>
        <ins class="cellChanged AmdtInsertedAIRAC" title="Date d'entrée en vigueur: 17 SEP 2015. " id="geaip_311221e8-2de7-4fce-b261-e0e9fb988238">001°49'52"E</ins>
</span>
我有一个错误(这很正常,这是一个python名称..):

所以。。。我该怎么做?

谢谢你的帮助

您可以使用findAll函数,然后删除所有结果

for d in soup.findAll('del'):
  d.decompose()

太好了,谢谢!BeautifulSoup没有为del标记定义类?不确定。我更喜欢使用lxml)为什么?(很抱歉提出这些问题!:p)它比beautifulsoup快得多
  File "algo.py", line 52
    soup.del.decompose()
           ^
SyntaxError: invalid syntax.
for d in soup.findAll('del'):
  d.decompose()