Cara menemukan teks tag h2 dalam permintaan python-html

# importing the HTMLSession class
from requests_html import HTMLSession
# create the object of the session
session = HTMLSession()
# url of the page
web_page = 'https://www.investopedia.com/terms/s/sample.asp'
# making get request to the webpage
respone = session.get(web_page)
# getting the html of the page
page_html = respone.html
# finding all h2 tags
h2_tags= page_html.find('h2')
# extracting text from all h2 tags
for tag in h2_tags:
    print(tag.text)Copy Code
Pythonist