bs4 python find the value of a h1 tag code example
Example 1: beautifulsoup get h1
company = soup.find('h1', {'class' : 'listing-name'})
Example 2: web scraping print all p and h2 tags
import requests
from bs4 import BeautifulSoup
url = 'https://www.python.org/'
reqs = requests.get(url)
soup = BeautifulSoup(reqs.text, 'lxml')
print("List of all the h1, h2, h3 :")
for heading in soup.find_all(["h1", "h2", "h3"]):
print(heading.name + ' ' + heading.text.strip())