python list 使用remove删除元素会遇到的坑
python中使用list的时候,通常需要用到移除其中某些元素,而remove函数就正好可以移除元素,所以就会想到循环遍历list,利用remove函数移除元素,例如下面一段代码:def remove_item(l,n):
for item in l:
if item==n:
l.remove(item)
if __name__ == "__main...
原创
2018-06-07 17:13:38 ·
21142 阅读 ·
1 评论