1 >>> a, *b, c = [1, 2, 3, 4, 5] 2 >>> a 3 1 4 >>> b 5 [2, 3, 4] 6 >>> c 7 5
c=5,
a=1,
然后剩下的值全部赋给b
1 >>> a = [0, 1, 2, 3, 4, 5] 2 >>> LASTTHREE = slice(-3, None) 3 >>> LASTTHREE 4 slice(-3, None, None) 5 >>> a[LASTTHREE] 6 [3, 4, 5]