删除,删除和弹出列表之间的区别 - Difference between del, remove and pop on lists

问题:

>>> a=[1,2,3]
>>> a.remove(2)
>>> a
[1, 3]
>>> a=[1,2,3]
>>> del a[1]
>>> a
[1, 3]
>>> a= [1,2,3]
>>> a.pop(1)
2
>>> a
[1, 3]
>>>

Is there any difference between the above three methods to remove an element from a list? 以上三种从列表中删除元素的方法之间有什么区别吗? spa


解决方案:

参考一: https://stackoom.com/question/mL0O/删除-删除和弹出列表之间的区别
参考二: https://oldbug.net/q/mL0O/Difference-between-del-remove-and-pop-on-lists
相关文章
相关标签/搜索