shubham3git
12/11/2018 - 8:59 AM

Decode A Web Page

Decode A Web Page

#Use the BeautifulSoup and requests Python packages 
#to print out a list of all the article titles on the New York Times homepage.
import requests
url = 'https://www.nytimes.com/'
r = requests.get(url)
r_html = r.text
from bs4 import BeautifulSoup
soup = BeautifulSoup(r_html,"lxml")
title = soup.find_all('h2')
print(title)