在文档中是
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):
文档是否错误或者该函数是否在某处进行了检测?
最佳答案
这取决于Python版本。
该函数文档的最后一行指出:
Changed in version 2.7.9: cafile, capath, cadefault, and context were added.
关于python - urllib2.urlopen 的真实签名是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29575838/