Python Ajouter au premier index
In [1]: ls = [1,2,3]
In [2]: ls.insert(0, "new")
In [3]: ls
Out[3]: ['new', 1, 2, 3]
Homely Hamerkop
In [1]: ls = [1,2,3]
In [2]: ls.insert(0, "new")
In [3]: ls
Out[3]: ['new', 1, 2, 3]
array.insert(index, value)
x = [1,3,4]
a = 2
x.insert(1,a)
print(x)
#Will print: [1,2,3,4]
# list.insert(before, value)
list = ["a", "b"]
list.insert(0, "c")
print(list) # ['c', 'a', 'b']