Python Web Scraping: Get the number of datasets currently listed on data.gov
Python Web Scraping: Exercise-3 with Solution
Write a Python program to get the number of datasets currently listed on data.gov.
from lxml import html import requests response = requests.get('http://www.data.gov/') doc_gov = html.fromstring(response.text) link_gov = doc_gov.cssselect('small a') print("Number of datasets currently listed on data.gov:") print(link_gov.text)
Number of datasets currently listed on data.gov: 285,397 datasets
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework