理解Python的*args, **kwargs

1 # coding=utf-8
2 def speak(*args, **kwargs):
3     print args, kwargs
4     
5     
6 a = 1
7 b = 2
8 c = 3
9 speak(a, b, c, b, c, a, c, a, b, d=a, e=b, f=c)

output:

(1, 2, 3, 2, 3, 1, 3, 1, 2) {'e': 2, 'd': 1, 'f': 3}

原文地址:https://www.cnblogs.com/MrWho/p/3972427.html