刚刚学习,很新
>>> numbers = [1,2,3,4,5,6,7,8,9,10] >>> numbers[0:10:2] [1,3,5,7,9] >>> numbers[::4] [1,5,9] >>> numbers[8:3:-1] [9,8,7,6,5] >>> numbers[10:0:-2] [10,8,6,4,2] >>> numbers[::-2] [10,8,6,4,2] >>> numbers[5::-2] [6,4,2] >>> numbers[:5:-2] [10,8]
开阔眼界了