大家好,欢迎来到IT知识分享网。
什么事Sysdasda
梦游就梦游,你自己又醒不过来,如果白天睡觉你梦游的话,提前告诉你爸妈,说我如果梦游就叫醒我,这样可以安全
python函数中def func(*args)这里*的作用是什么?
def fun_var_args(farg, *args):
print “arg:”, farg
for value in args:
print “another arg:”, value
fun_var_args(1, “two”, 3) # *args可以当作可容纳多个变量组成的listapply(function, args[, keywords])
the function argument must be a callable object (a user-defined or built-in function or method, or a class object) and the argsargument must be a sequence. the function is called with args as the argument list; the number of arguments is the length of the tuple. if the optional keywords argument is present, it must be a dictionary whose keys are strings. it specifies keyword arguments to be added to the end of the argument list. calling apply() is different from just calling function(args), since in that case there is always exactly one argument. the use of apply() is equivalent to function(*args, keywords).
deprecated since version 2.3: use function(*args, keywords) instead of apply(function, args, keywords) (see unpacking argument lists).
你看看文档嘛。。。。就是当call这个object时调用self.func并且使用self.args给的参数。。*args是多个变量组成的元组(tuples)
附上代码:
def count_number(*args):
print(args)
print(type(args))
count_number(‘hgfh’,’dasda’)
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/140098.html