发布时间:2019-09-10 08:55:29编辑:auto阅读(2196)
Python允许你实时地创建函数参数列表. 只要把所有的参数放入一个元组中, 然后通过内建的 apply
函数调用函数. 如 Example
1-1.
File: builtin-apply-example-1.py
def function(a, b):
print a, b
apply(function, ("whither", "canada?"))
apply(function, (1, 2 + 3))
apply
Removes usage of apply(). For example apply(function, *args, **kwargs) is converted to function(*args, **kwargs).
意思说, 取消了appy方法的使用,例如,用function(* args, **kwargs) 代替了方法appy
所以上文例子如下面写:
>>> def add(a, b):
print(a,b)
>>> add('I am', ' albertshao')
I am albertshao
上一篇: Python这五个就业方向最有前途和发展
下一篇: Python 模拟Ajax/XMLHtt
50494
49796
40395
37414
31832
28693
27625
22409
22409
20723
480°
1095°
896°
833°
1078°
954°
1568°
2935°
2609°
2008°