Beautifulsoup: get_text() Example
Syntax
element.get_text()
get_text() Example
from bs4 import BeautifulSoup
html = """
<div>
<h2>Syntax2</h2>
<h3>Syntax3</h3>
</div>
"""
soup = BeautifulSoup(html, 'html.parser')
# Find div Tag
el = soup.find('div')
# Get value of elements inside div
print(el.get_text())
output:
Syntax2
Syntax3