Created
December 4, 2014 20:19
-
-
Save pkpp1233/2ff2513003bfb4866a61 to your computer and use it in GitHub Desktop.
Scrape Function
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 bs4 import BeautifulSoup | |
| sport = "nhl" | |
| html = urllib.urlopen("http://www.espn.com/" + sport).read() | |
| headlines = [headline.get_text() for headline in BeautifulSoup(html).find(class_="headlines").find_all('li')] | |
| print headlines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment