我正在尝试使用 wunderground python API 提取历史天气数据,但是我反复遇到错误。有人可以帮忙吗:
import requests
def get_precip(gooddate):
urlstart = 'http://api.wunderground.com/api/INSERT_KEY_HERE/history_'
urlend = '/q/Switzerland/Zurich.json'
url = urlstart + str(gooddate) + urlend
data = requests.get(url).json()
for summary in data['history']['dailysummary']:
print ','.join((gooddate,summary['date']['year'],summary['date']['mon'],summary['date']['mday'],summary['precipm'], summary['maxtempm'], summary['meantempm'],summary['mintempm']))
错误:
File "<ipython-input-49-802c58ba5307>", line 9
print ','.join((gooddate,summary['date']['year'],summary['date']['mon'],summary['date']['mday'],summary['precipm'],'maxtempm',summary['meantempm'],summary['mintempm']))
^
SyntaxError: invalid syntax