Python Web Scraping: Display the name of the most recently added dataset on data.gov
Python Web Scraping: Exercise-5 with Solution
Write a Python program to display the name of the most recently added dataset on data.gov.
from lxml import html import requests response = requests.get('http://catalog.data.gov/dataset?q=&sort=metadata_created+desc') doc = html.fromstring(response.text) title = doc.cssselect('h3.dataset-heading').text_content() print("The name of the most recently added dataset on data.gov:") print(title.strip())
The name of the most recently added dataset on data.gov: Small Cell Locations
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to convert an address (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739).
Next: Write a Python program to extract h1 tag from example.com
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