【发布时间】:2012-07-17 09:18:47
【问题描述】:
有没有办法只在text=True不指定标签的情况下获取HTML标签属性。
例子:
html=<p class="c4">SOMETEXT</p>
我能做到:
[tag.attrs for tag in soup.findAll('p')]
>>> [[(u'class', u'c1')]]
有没有办法:
[text.attrs for text in soup.findAll(text=True)]
非常感谢!
【问题讨论】:
标签: python html beautifulsoup