我正在尝试从阳光基础打开此API的URL,并从json中的页面返回数据.这是我生成的代码,减去myapikey周围的括号.
import urllib.request.urlopen
import json
urllib.request.urlopen("https://sunlightlabs.github.io/congress/legislators?api_key='(myapikey)")
Run Code Online (Sandbox Code Playgroud)
我得到这个错误
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named request.urlopen
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?香港专业教育学院研究了https://docs.python.org/3/library/urllib.request.html仍然没有进展