Python中*args是元组或者数列,**kwargs是字典,经常函数里面参数def A(*args,**kwargs)就是表示能接受任意参数,而但是在参数带进函数后,*args就变得不同,以数组的形式表示。
def A(*args):
print args
A(1,2,3,4,'a')
显示的结果是元组形式的
(1,2,3,4,'a')
**kwargs在函数是字典形式{}
def A(**kwargs):
print kwargs
A(a=1)
输出就俄国是
{'a':1}
这也解释了为什么这两者作为函数参数能接受任意参数。