标签:python
1,*args 相当于list列表
def fun_args(farg, *args): print "arg:", farg for value in args: print "another arg:", value fun_args(1, "2", 3) # *args可以当作可容纳多个变量组成的list
2,**kwargs的用法 相当于字典
def fun_kwargs(farg, **kwargs): print "arg:", farg for key in kwargs: print "another keyword arg: %s: %s" % (key, kwargs[key]) fun_kwargs(farg=1, myarg2="2", myarg3=3)
标签:python
原文地址:http://blog.csdn.net/joeyon1985/article/details/38897843