def f1(a,b,c,d=0,*args,**kw):
print('a =',a,'b =',b,'c =',c,'d=',d,'args =',args,'kw =',kw)
args=(1,2,3)
kw0={'d':99}
kw1={'dd':99}
f1(*args,**kw0)
f1(*args,**kw1)
想想为什么?
('a =', 1, 'b =', 2, 'c =', 3, 'd=', 99, 'args =', (), 'kw =', {})
('a =', 1, 'b =', 2, 'c =', 3, 'd=', 0, 'args =', (), 'kw =', {'dd': 99})
第一个传入参数:
f1(1,2,3,d=99)
第二个传入参数:
f1(1,2,3,dd=99)