Created
August 15, 2016 17:34
-
-
Save manichabba/7d357c535d304808bb14b619646ebc58 to your computer and use it in GitHub Desktop.
Number scraping using beatiful soup from content of span tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
from BeautifulSoup import * | |
url = raw_input("Enter the URL:") | |
html = urllib.urlopen(url).read() | |
soup = BeautifulSoup(html) | |
tags=soup('span') | |
x = list() | |
for tag in tags: | |
x.append(tag.contents[0]) | |
print sum(map(int, x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment