Complete the Python program below to display the name of the most recently added dataset and collect the total number of datasets currently listed on the URL provided below. !pip install cssselect from lxml import html import requests response = requests.get('http://catalog.data.gov/dataset?q=&sort=metadata_created+desc') doc = html.fromstring(response.content) #TO DO -- Complete the Code
Complete the Python program below to display the name of the most recently added dataset and collect the total number of datasets currently listed on the URL provided below.
!pip install cssselect
from lxml import html
import requests
response = requests.get('http://catalog.data.gov/dataset?q=&sort=metadata_created+desc')
doc = html.fromstring(response.content) #TO DO -- Complete the Code
title = doc.cssselect('h3.dataset-heading')[0].text_content() #TO DO -- Complete the Code
print("The name of the most recently added dataset on data.gov:")
print(title.strip())
response1 = requests.get('http://www.data.gov/')
doc_gov = #TO DO -- Complete the Code
link_gov = #TO DO -- Complete the Code
print("Number of datasets currently listed on data.gov:")
print(link_gov.text)
the first part of the question is completed. the problem is more the second part, the section of code that is in bold that is giving me trouble
1. Complete the Python program below to display the name of the most recently added dataset and collect the total number of datasets currently listed on the URL provided below.
Solution given below:-
Trending now
This is a popular solution!
Step by step
Solved in 3 steps