会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
tochenwei
博客园
首页
新随笔
联系
订阅
管理
10 2022 档案
python 如何对list循环操作中删除某一个元素
摘要:# 方法1:拷贝出一个新list,如果这个list比较大会浪费比较多内存 num_list = [1, 2, 3, 4, 5] print(num_list) for item in num_list[:]: if item == 2: num_list.remove(item) else: pri
阅读全文
posted @
2022-10-20 10:10
tochenwei
阅读(113)
评论(0)
推荐(0)
编辑
公告