【发布时间】:2020-07-12 15:54:47
【问题描述】:
我知道...从标题来看,这个答案似乎与其他人一样。但我仍然搜索了所有相关和类似的问题。我要问的是,鉴于这个 html(只是一个例子):
<html>
<body>
<div class="div-share noprint">
<div class="addthis_toolbox addthis_default_style">
<a class="btn btn-xs btn-share addthis_button_facebook" href="https://somelink" target="_blank">
<span class="playblk"><img alt="someimg" class="playblk" height="25" src="some source" title="sometitle" width="25"/></span>
</a>
<a class="btn btn-xs btn-share addthis_button_facebook" href="https://somelink" target="_blank">
<span class="playblk"><img alt="someimg" class="playblk" height="25" src="some source" title="sometitle" width="25"/></span>
</a>
</div>
</div>
<div class="addthis_toolbox addthis_default_style">
<a class="btn btn-xs btn-share addthis_button_facebook" href="https://somelink" target="_blank">
<span class="playblk"><img alt="some img" class="playblk" height="25" src="othersource" title="some othertitle" width="25"/></span>
</a>
</div>
<div class="div-share">
<h1>"The Divine Wings Of Tragedy" lyrics</h1></div>,
<div class="pther">
<h2><b>Symphony X Lyrics</b></h2>
</div>
<div class="ringtone">
<span id="cf_text_top"></span>
</div>
<div>
<i>[Part I - At the Four Corners of the Earth]</i>
<br/>
<br/> On the edge of paradise
<br/> Tears of woe fall, cold as ice
<br/> Hear my cry
<br/>
</div>
</body>
</html>
我想找到唯一没有属性的标签。不像我在其他问题中看到的那样,不是一个 empy attr,也不是一个奇怪的特定属性,或者 attrs = None ...那个标签没有别的东西。但是如果我使用 findAll,我会在 html 中找到所有其他标记。如果我使用 attrs = False、attrs = None 等等,也是一样的......,
那么有可能吗?
非常感谢!
【问题讨论】:
标签: python beautifulsoup