a=[1,2,3,4,5]del a[2:4]print(a)
L = ['a', 'b', 'c','d']L = L[1:3] //['b','c']
你可以试试下面这个方案indices = 0, 2somelist = [i for j, i in enumerate(somelist) if j not in indices]