Skip to content

Instantly share code, notes, and snippets.

@ash17791
Created February 28, 2019 10:56
Show Gist options
  • Save ash17791/94c55476beb217404c1c4366ce1eb15a to your computer and use it in GitHub Desktop.
Save ash17791/94c55476beb217404c1c4366ce1eb15a to your computer and use it in GitHub Desktop.
Write a Python program to extract h1 tag from example.com.
from bs4 import BeautifulSoup
import requests
url = requests.get('http://www.example.com/')
soup = BeautifulSoup(url.text, 'html.parser')
story1 = soup.find_all('h1')
for i in story1:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment