发布时间:2019-09-10 08:55:29编辑:auto阅读(2289)
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
51346
50809
41402
38203
32693
29586
28417
23302
23258
21590
1667°
2400°
2007°
1943°
2275°
1973°
2679°
4480°
4307°
3071°