Python Web Scraping: Extract h1 tag from example.com
Python Web Scraping: Exercise-6 with Solution
Write a Python program to extract h1 tag from example.com.
from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen('http://www.example.com/') bsh = BeautifulSoup(html.read(), 'html.parser') print(bsh.h1)
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to display the name of the most recently added dataset on data.gov
Next: Write a Python program to extract and display all the header tags from en.wikipedia.org/wiki/Main_Page
What is the difficulty level of this exercise?
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join