发布时间:2019-09-10 08:55:29编辑:auto阅读(2421)
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
52055
51922
42149
38994
33494
30445
29082
24111
24018
22369
119°
152°
164°
148°
174°
161°
182°
187°
186°
200°