假设我有一个数字列表:
L = [1, 2, 3, 4, 5]
当我迭代它时,如何从列表中删除一个元素,比方说3?
我尝试了以下代码,但它没有这样做:
for el in L: if el == 3: del el
有任何想法吗?
谢谢,Boda Cydo.
python
python ×1