*args 将参数打包成 tuple 给函数体调用
**kwargs 将参数打包成 dict 给函数体调用
def param_case(*args, **kwargs):
print("==args {}".format(args),type(args),len(args))
print("==kwargs {}".format(kwargs),type(kwargs),len(kwargs))
if __name__ == '__main__':
print("不带参数==========")
param_case()
print("args传参==========")
param_case({"姓名":"hedy"},{"性别":"女"})
print("kwargs传参==========")
param_case(a=3)
print("同时传参==========")
param_case(0, a=3, b=9)
不带参数==========
==args () <class 'tuple'> 0
==kwargs {} <class 'dict'> 0
args传参==========
==args ({'姓名': 'hedy'}, {'性别': '女'}) <class 'tuple'> 2
==kwargs {} <class 'dict'> 0
kwargs传参==========
==args () <class 'tuple'> 0
==kwargs {'a': 3} <class 'dict'> 1
同时传参==========
==args (0,) <class 'tuple'> 1
==kwargs {'a': 3, 'b': 9} <class 'dict'> 2