From 5e7d1f491705205c9eed83bef0810167277ba1ed Mon Sep 17 00:00:00 2001 From: Anshu Kumari Mahato Date: Sun, 4 Oct 2020 20:24:15 +0530 Subject: [PATCH] Updated Scraping HTML Data with BeautifulSoup.py Updated the code to support in python 3 --- Week-4/Scraping HTML Data with BeautifulSoup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Week-4/Scraping HTML Data with BeautifulSoup.py b/Week-4/Scraping HTML Data with BeautifulSoup.py index f9670a3..1e61247 100644 --- a/Week-4/Scraping HTML Data with BeautifulSoup.py +++ b/Week-4/Scraping HTML Data with BeautifulSoup.py @@ -16,12 +16,14 @@ will read the data directly from the URL. Note: Each student will have a distinct data url for the assignment - so only use your own data url for analysis. ''' + import urllib +from urllib.request import urlopen from bs4 import BeautifulSoup url = raw_input('Enter - ') -html = urllib.urlopen(url).read() +html = urlopen(url).read() soup = BeautifulSoup(html) tag = soup("span") count=0 @@ -30,5 +32,5 @@ x=int(i.text) count+=1 sum = sum + x -print count -print sum +print (count) +print (sum)