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)
版权声明:本文博客原创文章。博客,未经同意,不得转载。