我知道…从标题上看,这个答案似乎和其他成千上万的答案一样。但我仍然搜索了所有相关和类似的问题。我想问的是,考虑到这个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属性,也不是奇怪的特定属性,或者attrs=None。。。那个标签没有别的东西。但是如果我使用findAll,我会在html中找到所有其他标记。如果我使用attrs=False、attrs=None等等,也是一样的
那么有可能吗
非常感谢
您可以将lambda函数传递给
find_all
方法,该方法检查标记名以及元素中是否没有属性:相关问题 更多 >
编程相关推荐