>>> aList = [1,2,3,4,5,6,7] >>> aList[2:] [3, 4, 5, 6, 7] >>> aList[10:] [] >>> aList[-2:] [6, 7] >>> aList[:2] [1, 2] >>> aList[:-2] [1, 2, 3, 4, 5]
时间: 2024-10-18 07:56:41
>>> aList = [1,2,3,4,5,6,7] >>> aList[2:] [3, 4, 5, 6, 7] >>> aList[10:] [] >>> aList[-2:] [6, 7] >>> aList[:2] [1, 2] >>> aList[:-2] [1, 2, 3, 4, 5]