迭代list的时候不能修改这个list,否则,可能会出错. numbers=[1,0,3,5,0] numbers.sort() print(numbers) print('*************') for i in numbers: print(i) if (i<5): #如果i是5,则弹出 numbers.pop(0) else: break print(numbers) 输出为: [0, 0, 1, 3, 5] ************* 0 [0, 1, 3, 5] 1 [1, 3…