list=[10,20,30,40,50,60,70,80] print(list[6:0:-2]) print(list[6:0:-1]) print(list[6:0:-1]) print(list[1:6:1])
E:\PycharmProjects\pythonProject\venv\Scripts\python.exe E:/PycharmProjects/pythonProject/demon1/demo1.py [70, 50, 30] [70, 60, 50, 40, 30, 20] [70, 60, 50, 40, 30, 20] [20, 30, 40, 50, 60] 进程已结束,退出代码0
语法格式 列表名[start:stop:step]
切片范围为左闭右开区间(左边数能取到,右边不能)
标签:20,python,30,list,50,40,列表,切片,print From: https://www.cnblogs.com/988MQ/p/16601490.html