我不明白为什么会收到“无效语法”错误。我做了一个小时的研究,没有成功。我正在运行 PYTHON 3。这段代码中的语法错误在哪里?
from urllib.request import urlopen
import json
request = urlopen("http://api.aerisapi.com/observations/Urbandale,IA?client_id=QD2ToJ2o7MKAX47vrBcsC&client_secret=0968kxX4DWybMkA9GksQREwBlBlC4njZw9jQNqdO")
response = request.read().decode("utf-8")
json = json.loads(response)
if json['success']:
ob = json['respnose']['ob']
print ("the current weather in urbandale is %s with a temperature of %d") % (ob['weather'].lower(), ob['tempF']
else
print "An error occurred: %s" % (json['error']['description'])
request().close