我正在尝试为我的高级编码课程使用 API,无论我做什么,我总是会收到此错误。我怎么能......呃......没有得到错误?提前致谢。
ETA:我相信我正在使用 IDLE 3.4。
from pprint import pprint
import requests
import encodings.idna
r = requests.get('http://api.openweathermap.org/data/2.5/weather?q=London')
pprint(r.json())
现在我收到一条错误消息:
Traceback (most recent call last):
File "/Users/lilyevans/APIproject.py", line 4, in <module>
r = requests.get('http://api.openweathermap.org/data/2.5/weather?q=London')
AttributeError: 'module' object has no attribute 'get'