Using beautifulsoup to extract text between line breaks (e.g. <br /> tags)
Posted
by
Michael Altman
on Stack Overflow
See other posts from Stack Overflow
or by Michael Altman
Published on 2011-03-11T16:08:52Z
Indexed on
2011/03/11
16:10 UTC
Read the original article
Hit count: 247
I have the following HTML that is within a larger document
<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 />
I'm currently using BeautifulSoup to obtain other elements within the HTML, but I have not been able to find a way to get the important lines of text between <br />
tags. I can isolate and navigate to each of the <br />
elements, but can't find a way to get the text in between. Any help would be greatly appreciated. Thanks.
© Stack Overflow or respective owner