python中的insert

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

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

输出结果:

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

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

原文地址:https://www.cnblogs.com/xwqhl/p/10675166.html