To insert several values at a specific position in a Python list, assign them to an empty slice: items[index:index] = values. For example, items[1:1] = ["b", "c"] inserts both values before the item currently at index 1. To add values at the end, use items.extend(values).
Insert multiple values at a specific index
Use a slice whose start and end are the same. This selects no existing elements, so Python inserts the iterable’s contents at that position without replacing anything:
items = ["a", "d"]
items[1:1] = ["b", "c"]
print(items) # ['a', 'b', 'c', 'd']
The slice starts at index 1, so the new values go before the element that was at that index. Slice assignment accepts an iterable, not just a list; for example, a generator works too:
items = [10, 40]
new_values = (value for value in (20, 30))
items[1:1] = new_values
# items is now [10, 20, 30, 40]
Use the ordinary contiguous slice form items[index:index] for insertion. Extended slices with a step other than 1 have a length constraint: the assigned iterable must contain as many items as the slice selects. See the Python built-in types reference.
#1 Best Overall
Choose the operation that matches the job
| Need | Use | What it does |
|---|---|---|
| Insert several values at a chosen position | items[index:index] = values |
Inserts the iterable’s contents at the index without removing existing elements. |
| Add several values at the end | items.extend(values) |
Appends the iterable’s contents to the list. |
| Insert one value before an index | items.insert(index, value) |
Inserts a single value. At len(items), it is equivalent to appending one value. |
Python documents insert and extend in its list-method tutorial; slice assignment is defined in the built-in types reference.
Why list.insert() adds only one value
list.insert(index, value) takes one value and places it before the element at index. If you pass a list as the value, that list becomes one nested element; its contents are not spread into the original list. For a batch of values, use empty-slice assignment at a chosen position or extend at the end.
Rank #2
You can call insert repeatedly, but repeated calls at one fixed index reverse the input order unless you process the values in reverse:
items = ["a", "d"]
for value in reversed(["b", "c"]):
items.insert(1, value)
# ['a', 'b', 'c', 'd']
Each call inserts before whatever is currently at index 1. A direct batch slice assignment is usually simpler when you already have all the values.
Avoid two common assignment mistakes
items[index] = valuesreplaces one existing element with the wholevaluesobject. It does not insert the iterable’s contents as separate elements. Useitems[index:index] = valueswhen you want insertion.- Do not assign the result of
insert,extend, or slice assignment back to the list. These operations mutate the existing list; list methods such asinsertandextendreturnNone, rather than the modified list. This follows Python’s documented convention for mutable data structures in the list-method tutorial.
Use a deque for a queue that changes at both ends
Inserting repeatedly at the beginning of a list requires shifting the other elements. If your data structure needs frequent appends and removals at both ends, Python’s tutorial recommends collections.deque for that queue pattern rather than using a list as a front-insertion queue. See the Python 3.11 tutorial’s queue guidance.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




