简体   繁体   中英

Python - default arguments in function

Looking at the python doc http://docs.python.org/library/urllib2.html

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

So, I pass in a url, then optional data and timeout variables (from how I read it).

So if I want to pass a timeout, but not the data... whats the default variable for data? Do you just do,

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

Thanks :)

您使用参数名称:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM