【发布时间】:2012-05-28 02:13:04
【问题描述】:
我无法从this weather website 获取一些信息。我主要是试图检索“当前状况”信息表。 这是我目前所拥有的,但它给了我一些错误。
import urllib2
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.timeanddate.com/weather/usa/los-angeles').read())
for row in soup('table', {'class' : 'rpad'})[0].tbody('trtd'):
tds = row('tr')
print tds.string
【问题讨论】:
-
您能否提供您收到的错误信息,包括回溯信息?
-
Traceback(最近一次调用最后一次):文件“C:\Users\Andrew\Desktop\test.py”,第 8 行,在
中 for row in soup('table', {' class' : 'rpad'})[0].tbody('trtd'): TypeError: 'NoneType' object is not callable -
我不确定自己做错了什么
标签: python web-scraping