遍历列表时,请勿修改列表:
for x in schedule: if 'DELETE' in x: schedule.remove(x)
相反,请尝试:
schedule[:] = [x for x in schedule if 'DELETE' not in x]
有关更多信息,请参见如何在迭代时从列表中删除项目?

遍历列表时,请勿修改列表:
for x in schedule: if 'DELETE' in x: schedule.remove(x)
相反,请尝试:
schedule[:] = [x for x in schedule if 'DELETE' not in x]
有关更多信息,请参见如何在迭代时从列表中删除项目?