python中的remove

it2026-05-14  14

python中的remove

remove()从左到右寻找,移除找到的第一个指定元素,举个例子:

1 a = ["hello", "world", "world", "dlrb"] 2 a.remove("world") 3 print(a)

输出结果:

['hello', 'world', 'dlrb']

从左到右寻找,只移出找到的第一个world

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

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

最新回复(0)