python中的del

it2026-05-03  7

python中的del

del可以删除列表中指定位置的元素,举个例子:

1 a = ["hello", "world", "dlrb", "girl"] 2 del a[1:3] 3 print(a)

输出结果:

['hello', 'girl']

我们指定删除列表a中位置1、2的元素

posted on 2019-04-09 10:02 恒笛 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/xwqhl/p/10675136.html

相关资源:数据结构—成绩单生成器
最新回复(0)