urllib2.urlopen的真正签名是什么

2024-03-29 11:27:46 发布

您现在位置:Python中文网/ 问答频道 /正文

在文件里是这样的

urllib2.urlopen(url[, data[, timeout[, cafile[, capath[, cadefault[, context]]]]]) Open the URL url, which can be either a string or a Request object.

https://docs.python.org/2/library/urllib2.html

但在模块代码中:

def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):

是文档错误还是函数在某个地方插入了指令?你知道吗


Tags: 文件theurlwhichdatacontexttimeoutopen
1条回答
网友
1楼 · 发布于 2024-03-29 11:27:46

这取决于Python版本。你知道吗

此函数文档的最后一行说明:

Changed in version 2.7.9: cafile, capath, cadefault, and context were added.

相关问题 更多 >