In python, I wrote this function to teach myself how **kwargs
works in Python:
def fxn(a1, **kwargs):
print a1
for k in kwargs:
print k, " : ", kwargs[k]
I then called this function with
fxn(3, a2=2, a3=3, a4=4)
Here was the output that my Python interpreter printed:
3
a3 : 3
a2 : 2
a4 : 4
Why did the for loop print the value of a3 before that of a2 even though I fed a2 into my function first?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…