2019年3月9日 解压序列

l=[1,2,3,3,4,6,7,5]
a,*b,c=l
print(a,b,c)

>>1 [2, 3, 3, 4, 6, 7] 5

a,b,c,d,*e='hello'
print(a,b,c,d,e)

>>h e l l ['o']

x=3
y=4
x,y=y,x
print(x,y)

x,y值互换

猜你喜欢

转载自www.cnblogs.com/python1988/p/10499461.html
今日推荐