Skip to content

Commit 45ea5b0

Browse files
authored
Scraping_HTML_Data_with_BeautifulSoup
1 parent 960cdde commit 45ea5b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import urllib.request, urllib.parse, urllib.error
2+
from bs4 import BeautifulSoup
3+
import ssl
4+
5+
ctx = ssl.create_default_context()
6+
ctx.check_hostname = False
7+
ctx.verify_mode = ssl.CERT_NONE
8+
9+
url = input('Enter - ')
10+
html = urllib.request.urlopen(url).read()
11+
soup = BeautifulSoup(html, 'html.parser')
12+
tags = soup("span")
13+
14+
sum = 0
15+
count = 0
16+
for tag in tags:
17+
num = int(tag.text)
18+
count = count +1
19+
sum = sum + num
20+
21+
print(count)
22+
print(sum)

0 commit comments

Comments
 (0)