Quote:
Originally Posted by KevinH
In bs4, I think there is a get_text() that will work on any element to get all of the text under that element. But I am not 100% on that name.
|
get_text() is the correct name.
@Maui: If you're looking for a bs4 innerHTML equivalent, you could use
decode_contents() to return the inner HTML code of an element:
Code:
soup = BeautifulSoup('<p><a id="x1"></a>Test</p>')
soup.p.decode_contents()
# returns '<a id="x1"></a>Test'