list.insert(i, x)

list.insert(i, x)

list.insert(i, x) method

The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x).

Insert an item at a given position.

Related concepts

list.insert(i, x)

list.insert(i, x) — Structure map

Clickable & Draggable!

list.insert(i, x) — Related pages: