python中的del

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

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

输出结果:

['hello', 'girl']

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