不限定传入的值
- **kwargs:必须以字典方式传入
def a(name,**kwargs):
print(f'name:{name},kwargs = {kwargs}')
print(type(kwargs))
a(name = 'zhang',p ='f')
name:zhang,kwargs ={‘p’: ‘f’}
<class ‘dict’>
2.*args : 元组
def a(name,*args):
print(f'name:{name},args = {args}')
print(type(args))
a('zhang','f')
name:zhang,args = (‘f’,)
<class ‘tuple’>