I\'m adapting a web scraping program from, http://danielfrg.com/blog/2013/04/01/nba-scraping-data/#disqus_thread, to scrape ESPN for baseball data into a CSV. However when I
The error means that the table
variable that you are building by doing:
table = BeautifulSoup(r.text).table
is returning None
. And for row in table.find_all("tr")[1:]:
on a None
is throwing the error.
You can check if the url
in question has a table in the way you are trying to access it. You can do this by printing out the url
constructed by this statement:
BASE_URL.format(row['prefix_1'], year, row['prefix_2'])
and then going to this url in your browser to check if it has the table of your interest.