Skip to content

Instantly share code, notes, and snippets.

@manichabba
Created August 15, 2016 17:34
Show Gist options
  • Save manichabba/7d357c535d304808bb14b619646ebc58 to your computer and use it in GitHub Desktop.
Save manichabba/7d357c535d304808bb14b619646ebc58 to your computer and use it in GitHub Desktop.
Number scraping using beatiful soup from content of span tag
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