python中的insert

it2026-05-12  3

python中的insert

insert()往列表的指定位置添加元素,举个例子:

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

输出结果:

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

我们在列表a的位置1插入元素girl

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

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

最新回复(0)