Created
April 3, 2017 04:50
-
-
Save brianckeegan/ef46e198f8586a63c054942a5c660e63 to your computer and use it in GitHub Desktop.
Debugging baseball-reference standings scrape
This file contains 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
from bs4 import BeautifulSoup | |
import requests | |
# Get the data | |
raw = requests.get('http://www.baseball-reference.com/leagues/MLB/2016-standings.shtml').text | |
# Parse it | |
soup = BeautifulSoup(raw,'html.parser') | |
# Find the table | |
table = soup.find_all('table',{'id':'expanded_standings_overall'}) | |
# Should be true, but there's nothing in there | |
len(table) > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It turns out the data is hidden in a comment field.