【发布时间】:2011-07-13 14:52:19
【问题描述】:
我在一个较大的文档中有以下 HTML
<br />
Important Text 1
<br />
<br />
Not Important Text
<br />
Important Text 2
<br />
Important Text 3
<br />
<br />
Non Important Text
<br />
Important Text 4
<br />
我目前正在使用 BeautifulSoup 来获取 HTML 中的其他元素,但我无法找到一种方法来获取 <br /> 标记之间的重要文本行。我可以隔离并导航到每个 <br /> 元素,但找不到在两者之间获取文本的方法。任何帮助将不胜感激。谢谢。
【问题讨论】:
标签: python html html-parsing beautifulsoup