#正数索引,默认间隔为1,从左向右取,索引范围依次为0,1,2,3,,,,9 >>> print lista[1:4] [1, 2, 3] >>> print lista[1:7:2] [1, 3, 5] >>> >>> #负数索引,默认间隔为1,从左向右取,索引依次为-10,-9,-8,,,,-1 >>> >>> print lista[-1:-3] [] >>> print lista[-1:] [9] >>> print lista[-3:-1] [7, 8] >>> #间隔为负数,先翻转再从左向右取,索引依次是-1,-2,-3,,,,-10 >>> print lista[::-1] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] >>> print lista[:-5:-1] [9, 8, 7, 6] >>> print lista[-6:-1:-1] [] >>> print lista[-1:-6:-1] [9, 8, 7, 6, 5] >>>