例如:
squares = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] print(squares[2:6]) print(squares[3:8]) print(squares[0:1])
结果:
>>> [4, 9, 16, 25] [9, 16, 25, 36, 49] [0] >>>
0