废话不说,直接上代码(可能很多人以前不知道有这种方法):
a=[1,2,3]b=(1,2,3)c={1:"a",2:"b",3:"c"}print(a,"====",*a)print(b,"====",*b)print(c,"====",*c)运行结果为:
[1, 2, 3] ==== 1 2 3(1, 2, 3) ==== 1 2 3{1: 'a', 2: 'b', 3: 'c'} ==== 1 2 3
序列+*相当于解压,与zip的功能相反