Python_列表操作(删除)

删除

del 列表[索引]

del  a[1]

输出结果: ['张三', '王五']

*总结:删除列表下标第一个(张三下标为0,则下标1为李四)

 

del 列表[起始位置:结束位置]

del a[0:2]

输出: ['王五']

 

pop()删除

列表.pop(索引)

输出: ['张三', '王五']

 

remove()方法

b=[ "李四", "王五"]

remove(b)

print(a)

输出结果:['张三']

*总结:新建一个列表,在新建列表里输入要删除的内容,用remove(新建列表)

 

clear()方法       删除一个列表所有对象

列表. clear()

posted @ 2021-03-11 09:57  離落  阅读(269)  评论(0)    收藏  举报
{ "posted": "Dreamer-Paul", "version": "Live2DViewerEX Config 1.0", "model": "sagiri.moc", "textures": [ "textures/texture_00.png", "textures/texture_01.png" ], "layout": { "center_x": 0, "center_y": 0, "width": 2 }, "motions": { "tap": [ { "file": "motions/tap/c.mtn" } ], "idle": [ { "file": "motions/idle/idle_01.mtn" }, { "file": "motions/idle/idle_02.mtn" }, { "file": "motions/idle/idle_03.mtn" }, { "file": "motions/idle/idle_04.mtn" } ] }, "physics": "physics.json" }