发布时间:2019-09-10 08:55:29编辑:auto阅读(2160)
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
50044
49300
39961
37002
31396
28237
27195
21987
21937
20268
377°
292°
276°
451°
442°
1052°
1968°
1825°
1462°
2935°