def test(a, b, c, *args, **kwargs):
print(a)
print(b)
print(c)
print(args)
print(kwargs)
if __name__ == '__main__':
test(1, 2, 3, 44, 55, 66, d=777, e=888)
print("*" * 20)
A = [11, 22, 33]
B = {"d": 66, "e": 77}
test(11, 22, 33, A, B)
print("*" * 20)
test(11,22,33,*A,**B)#这就是在拆包
运行结果:
1
2
3
(44, 55, 66)
{'d': 777, 'e': 888}
********************
11
22
33
([11, 22, 33], {'d': 66, 'e': 77})
{}
********************
11
22
33
(11, 22, 33)
{'d': 66, 'e': 77}