遍历列表,并删除列表中小于5的值
a = [1,2,3,4,5,6,7,8]
i = 0
while i < len(a):
if a[i] > 5:
i = i + 1
else:
del a[i]
print(a)
遍历列表,并删除列表中小于5的值
a = [1,2,3,4,5,6,7,8]
i = 0
while i < len(a):
if a[i] > 5:
i = i + 1
else:
del a[i]
print(a)