问题:
>>> 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? 以上三种从列表中删除元素的方法之间有什么区别吗?
解决方案:
参考一: https://stackoom.com/question/mL0O/删除-删除和弹出列表之间的区别参考二: https://oldbug.net/q/mL0O/Difference-between-del-remove-and-pop-on-lists
来源:oschina
链接:https://my.oschina.net/u/4428122/blog/4325858