attributeerror

AttributeError when using “import dateutil” and “dateutil.parser.parse()” but no problems when using “from dateutil import parser”

妖精的绣舞 提交于 2020-12-02 00:03:05
问题 I was playing with the dateutil module in Python 2.7.3. I simply wanted to use: import dateutil dateutil.parser.parse("01-02-2013") But I got an error: AttributeError: 'module' object has no attribute 'parser' I checked what attributes dateutil does have: print dir(dateutil) # output: ['__author__', '__builtins__', '__doc__', '__file__', '__license__', # '__name__', '__package__', '__path__', '__version__'] The thing is, when I try to import parser from dateutil directly, it does seem to

Python error: 'NoneType' object has no attribute 'find_all'

僤鯓⒐⒋嵵緔 提交于 2020-11-28 02:40:30
问题 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 run the second piece of code to write a csv of games I get the 'NoneType' object has no attribute 'find_all' error, from the following section of code for index, row in teams.iterrows(): _team, url = row['team'], row['url'] r = requests.get(BASE_URL.format(row['prefix_1'], year, row['prefix_2'])) table = BeautifulSoup(r

Python error: 'NoneType' object has no attribute 'find_all'

孤街醉人 提交于 2020-11-28 02:40:17
问题 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 run the second piece of code to write a csv of games I get the 'NoneType' object has no attribute 'find_all' error, from the following section of code for index, row in teams.iterrows(): _team, url = row['team'], row['url'] r = requests.get(BASE_URL.format(row['prefix_1'], year, row['prefix_2'])) table = BeautifulSoup(r