Recall that <br>
is used inside <p>
, so here is a string hack.
html = html.replace("<br>", "</p><p>")
soup = BeautifulSoup(html, "html.parser")
soup.find_all('p')
Note that this is not an "open and closing paragraph" tag but rather "closing then opening".
<p>
part1
</p><p>
part2
</p><p>
part3
</p><p>
part4
</p>
Now all p
tags match each other, though a bit messy with line breaks, which can be fixed by soup.prettify()
.