Beautiful Soup Tag | strings property
strings property returns the inner text of an element. Unlike the
strings handles the case when the element contains multiple children.
Consider the following HTML document:
my_html = """<div><p>I like tea.</p><p>I like soup.</p></div>"""soup = BeautifulSoup(my_html)
To get the inner text of the
Notice how we end up with a whole bunch of spaces. To remove these awkward empty spaces, use the
stripped_strings property instead:
stripped_strings property omits lines that consist of just empty spaces, and also removes leading and trailing spaces.