#传参: 字典/键值对 def func(**kvargs): print('解包字典:') for k, v in kvargs.items(): print('{}:{}'.format(k, v)) #传键值对 func( name= 'Tom', age = 20) #传字典 employee = dict(name = 'Tom', age = 20) func(**employee) 打印结果: 解包字典: name:Tom age:20 解包字典: name:Tom age:20
#传参: 字典/键值对 def func(**kvargs): print('解包字典:') for k, v in kvargs.items(): print('{}:{}'.format(k, v)) #传键值对 func( name= 'Tom', age = 20) #传字典 employee = dict(name = 'Tom', age = 20) func(**employee) 打印结果: 解包字典: name:Tom age:20 解包字典: name:Tom age:20