最佳答案
您可能想要做的是导入 request
来自 urllib
的模块包,所以你可以使用 urlopen
request
中定义的函数模块。
import urllib.request
urllib.request.urlopen('https://stackoverflow.com/')
附加信息:
The legacy urllib.urlopen function from Python 2.6 and earlier has been discontinued; urllib.request.urlopen() corresponds to the old urllib2.urlopen. Proxy handling, which was done by passing a dictionary parameter to urllib.urlopen, can be obtained by using ProxyHandler objects. (https://docs.python.org/3/library/urllib.request.html)
关于python - 属性错误 : module 'request' has no attribute 'urlopen' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59093489/