**kwargs 的用法
def foo(param, *args, **kwargs): aaa = kwargs['aaa'] bbb = kwargs['bbb'] return param + aaa + bbb foo('123', aaa='456', bbb='789') 输出: '123456789'
*args 的用法
def foo(param, *args): print args foo(1, 'a', 'b', 'c') 输出: ('a', 'b', 'c')
下一篇:《python 类型验证》