【发布时间】:2016-05-01 10:59:50
【问题描述】:
我正在尝试从阳光基金会打开此 API 的 URL,并以 json 格式从页面返回数据。这是我生成的代码,减去 myapikey 周围的括号。
import urllib.request.urlopen
import json
urllib.request.urlopen("https://sunlightlabs.github.io/congress/legislators?api_key='(myapikey)")
我得到了这个错误
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request.urlopen
我做错了什么?我研究了https://docs.python.org/3/library/urllib.request.html 仍然没有进展
【问题讨论】:
标签: python python-3.x url urllib