Python 中 参数* 和 **

举个例子就知道了

class test():

    def __init__(self, *a, **b):
        print(a)
        print(b)
        print(b.get('test'))


tester = test(1, 2, 3, test='abc')

 

输出如下

(1, 2, 3)
{'test': 'abc'}
abc

Process finished with exit code 0

posted @ 2019-12-09 15:04  liuxianglong  阅读(207)  评论(0编辑  收藏  举报