1 #不定长参数 * 元祖 ** 字典 2 def item(a,b,*c,**d): 3 print(a) 4 print(b) 5 print(c) 6 print(d) 7 8 item(11,22,33,44,55,sum=11,done=22) 9 10 A = (11,22,33) 11 B = {'name':11,'age':12 } 12 item(11,22,33,*A,**B) #*/** 拆包
输出的内容为:
11
22
(33, 44, 55)
{'sum': 11, 'done': 22}
11
22
(33, 11, 22, 33)
{'name': 11, 'age': 12}