标签:python2 参数调用 hit def app fun UNC nbsp 函数
在python3中可以采用如下方法:
函数(*(元组))
函数(**{字典})
如下例子:
function(*("whither", "canada?")) 元组
function(*(1, 2 + 3)) 元组
function(**{"a": "crunchy", "b": "frog"}) 字典
在python2中,可以使用apply来实现
def function(a, b):
print a, b
apply(function, ("whither", "canada?"))
apply(function, (1, 2 + 3))
python3里函数怎么样使用元组或字典作为参数调用(复制他人博客)
标签:python2 参数调用 hit def app fun UNC nbsp 函数
原文地址:https://www.cnblogs.com/yekang/p/10159377.html