gpt4 book ai didi

Python - 函数中的默认参数

转载 作者:行者123 更新时间:2023-11-28 20:11:21 25 4
gpt4 key购买 nike

查看 python 文档 http://docs.python.org/library/urllib2.html

urllib2.urlopen(url[, data][, timeout])

所以,我传入了一个 url,然后是可选的数据和超时变量(根据我的阅读方式)。

所以如果我想传递超时,而不是数据...数据的默认变量是什么?你只是做,

urlopen('http://www.example.com/', , 5)

谢谢:)

最佳答案

您使用参数名称:

urlopen('http://www.exmaple.com/', timeout=5)

关于Python - 函数中的默认参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4009863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com