To extend a list, you just use list.extend. To insert elements from any iterable at an index, you can use slice assignment...

>>> a = list(range(10))
>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> a[5:5] = range(10, 13)
>>> a
[0, 1, 2, 3, 4, 10, 11, 12, 5, 6, 7, 8, 9]
Answer from mgilson on Stack Overflow
🌐
Analytics Vidhya
analyticsvidhya.com › home › python list insert() method with examples
Python List insert() Method With Examples - Analytics Vidhya
May 19, 2025 - However, the insert() method allows us to insert multiple elements at any desired index within the list. The extend() method is useful when adding multiple elements as a single entity, while the insert() method is more suitable for inserting ...
🌐
Educative
educative.io › answers › how-to-append-multiple-items-to-a-list-in-python
How to append multiple items to a list in Python
The extend() method allows you to add multiple elements from an iterable (e.g., a list, tuple, or another sequence) to the end of the original list. ... List concatenation involves two lists using the + operator to combine their elements and ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-list
How to Add Elements to a List in Python – Append, Insert & Extend | DigitalOcean
April 17, 2025 - To add items to a list in Python, you can use the append() method to add a single element to the end of the list, or the extend() method to add multiple elements. You can also use the insert() method to insert an element at a specific position in the list.
🌐
Altcademy
altcademy.com › blog › how-to-append-multiple-items-to-a-list-in-python
How to append multiple items to a list in Python
September 6, 2023 - Now, our numbers list contains nine elements: 1, 2, 3, 4, 5, 6, 7, 8, and 9. Notice that we passed the numbers we wanted to add as a list. This is important, as extend() expects a list of elements. Python also allows us to use the plus operator + to ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › append-multiple-items-to-list-python
Append Multiple items to List - Python - GeeksforGeeks
July 26, 2025 - The append() method is used to add a single item to the end of a list, however to append multiple items at once using the append() method, we can use it in a loop. Here's how: ... a = [1, 2, 3] b = [4, 5, 6] #Append multiple items one by one ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python append items elements to list
Python Append Items Elements to List - Spark By {Examples}
May 31, 2024 - In this article, you have learned how to append multiple items to the list in Python using the + operator, append(), extend() and slicing methods. The extend method appends elements into the list from another iterable.
🌐
ItSolutionstuff
itsolutionstuff.com › post › how-to-add-multiple-elements-to-a-list-in-pythonexample.html
How to Add Multiple Elements to a List in Python? - ItSolutionstuff.com
October 30, 2023 - You can use these examples with python3 (Python 3) version. ... myList = [1, 2, 3, 4] # Add new multiple elements to list myList.append(5) myList.append(6) myList.append(7) print(myList)
Find elsewhere
🌐
Python Guides
pythonguides.com › append-multiple-items-to-list-python
Insert Multiple Elements into a List in Python
September 30, 2025 - Learn how to insert multiple elements in Python lists using append(), extend(), insert(), and loops. Step-by-step practical examples with clear code snippets.
Top answer
1 of 6
141

l.insert(index, obj) doesn't actually return anything. It just updates the list.

As ATO said, you can do b = a[:index] + [obj] + a[index:]. However, another way is:

a = [1, 2, 4]
b = a[:]
b.insert(2, 3)
2 of 6
111

Most performance efficient approach

You may also insert the element using the slice indexing in the list. For example:

>>> a = [1, 2, 4]
>>> insert_at = 2  # Index at which you want to insert item

>>> b = a[:]   # Created copy of list "a" as "b".
               # Skip this step if you are ok with modifying the original list

>>> b[insert_at:insert_at] = [3]  # Insert "3" within "b"
>>> b
[1, 2, 3, 4]

For inserting multiple elements together at a given index, all you need to do is to use a list of multiple elements that you want to insert. For example:

>>> a = [1, 2, 4]
>>> insert_at = 2   # Index starting from which multiple elements will be inserted

# List of elements that you want to insert together at "index_at" (above) position
>>> insert_elements = [3, 5, 6]

>>> a[insert_at:insert_at] = insert_elements
>>> a   # [3, 5, 6] are inserted together in `a` starting at index "2"
[1, 2, 3, 5, 6, 4]

To know more about slice indexing, you can refer: Understanding slice notation.

Note: In Python 3.x, difference of performance between slice indexing and list.index(...) is significantly reduced and both are almost equivalent. However, in Python 2.x, this difference is quite noticeable. I have shared performance comparisons later in this answer.


Alternative using list comprehension (but very slow in terms of performance):

As an alternative, it can be achieved using list comprehension with enumerate too. (But please don't do it this way. It is just for illustration):

>>> a = [1, 2, 4]
>>> insert_at = 2

>>> b = [y for i, x in enumerate(a) for y in ((3, x) if i == insert_at else (x, ))]
>>> b
[1, 2, 3, 4]

Performance comparison of all solutions

Here's the timeit comparison of all the answers with list of 1000 elements on Python 3.9.1 and Python 2.7.16. Answers are listed in the order of performance for both the Python versions.

Python 3.9.1

  1. My answer using sliced insertion - Fastest ( 2.25 µsec per loop)

    python3 -m timeit -s "a = list(range(1000))" "b = a[:]; b[500:500] = [3]"
    100000 loops, best of 5: 2.25 µsec per loop
    
  2. Rushy Panchal's answer with most votes using list.insert(...)- Second (2.33 µsec per loop)

    python3 -m timeit -s "a = list(range(1000))" "b = a[:]; b.insert(500, 3)"
    100000 loops, best of 5: 2.33 µsec per loop
    
  3. ATOzTOA's accepted answer based on merge of sliced lists - Third (5.01 µsec per loop)

    python3 -m timeit -s "a = list(range(1000))" "b = a[:500] + [3] + a[500:]"
    50000 loops, best of 5: 5.01 µsec per loop
    
  4. My answer with List Comprehension and enumerate - Fourth (very slow with 135 µsec per loop)

    python3 -m timeit -s "a = list(range(1000))" "[y for i, x in enumerate(a) for y in ((3, x) if i == 500 else (x, )) ]"
    2000 loops, best of 5: 135 µsec per loop
    

Python 2.7.16

  1. My answer using sliced insertion - Fastest (2.09 µsec per loop)

    python -m timeit -s "a = list(range(1000))" "b = a[:]; b[500:500] = [3]"
    100000 loops, best of 3: 2.09 µsec per loop
    
  2. Rushy Panchal's answer with most votes using list.insert(...)- Second (2.36 µsec per loop)

    python -m timeit -s "a = list(range(1000))" "b = a[:]; b.insert(500, 3)"
    100000 loops, best of 3: 2.36 µsec per loop
    
  3. ATOzTOA's accepted answer based on merge of sliced lists - Third (4.44 µsec per loop)

    python -m timeit -s "a = list(range(1000))" "b = a[:500] + [3] + a[500:]"
    100000 loops, best of 3: 4.44 µsec per loop
    
  4. My answer with List Comprehension and enumerate - Fourth (very slow with 103 µsec per loop)

    python -m timeit -s "a = list(range(1000))" "[y for i, x in enumerate(a) for y in ((3, x) if i == 500 else (x, )) ]"
    10000 loops, best of 3: 103 µsec per loop
    
🌐
Bobby Hadz
bobbyhadz.com › blog › python-append-multiple-values-to-list-in-one-line
How to append multiple Values to a List in Python | bobbyhadz
Use list slicing assignment to insert multiple elements into a list at a specific index, e.g. list1[1:1] = list2. The elements of the second list will get inserted into the first at the given index.
🌐
Codecademy
codecademy.com › docs › python › lists › .insert()
Python | Lists | .insert() | Codecademy
May 29, 2025 - Though the index 10 is out of bounds for the list, Python will gracefully add "purple" to the end of the list. Passing a negative index to .insert() will make it start counting from the end of the list. No, .insert() only allows the addition of a single element at a time.
Top answer
1 of 2
11

Many languages (e.g. JavaScript, Perl) have a splice function of some sort to modify list contents. They allow you to insert list items or change existing ones to new sublists.

Python uses a "slice" approach, allowing you to specify many list edits without a specific splice function.

>>> myList = ["banana", "orange", "apple", "cherry", "grape"]
>>> myList[3:3] = ["mango", "papaya"]
>>> myList
['banana', 'orange', 'apple', 'mango', 'papaya', 'cherry', 'grape']

By the way, if this is hard to understand, this cheat sheet may help:

 ["banana", "orange", "apple", "cherry", "grape"]

  0_______  1_______  2______  3_______  4______ 5    # item index
  0:1_____  1:2_____  2:3____  3:4_____  4:5____      # equiv slice notation

  ^         ^         ^        ^         ^       ^    # slice notation for
  0:0       1:1       2:2      3:3       4:4     5:5  # 0_length positions
                                                      # between items

  0:2________________ 2:5_______________________      # misc longer slice 
            1:4_________________________              # examples
            1:5_________________________________
            1:__________________________________
  0:____________________________________________
  :_____________________________________________
  :3__________________________
  :1______

There are also negative indices (counting from the end of the list). Let's not get into those right now!

2 of 2
3

Note that .insert will modify the list in-place, so after the call result and myList will refer to the same list.

Your code is OK. If you wanted a bit of a shorter option, you could use slicing:

listName[n:n] = [var1, var2]

This inserts both var1 and var2 after the nth item in the list.

🌐
TechBeamers
techbeamers.com › python-list-insert
List Insert Method - TechBeamers
November 30, 2025 - Here is a table summarizing some important facts about the list.insert() method in Python: ... Inserting an element into a list at a specific index: This is the most common use case for the list.insert() method.
🌐
Pierian Training
pieriantraining.com › home › python tutorial: how to append multiple items to a list in python
Python Tutorial: How to append multiple items to a list in Python - Pierian Training
April 12, 2023 - In this example, we create a new ... conclusion, adding multiple items to a list in Python is easy using either the `extend()` method or the addition operator (`+`)....
🌐
CodeScracker
codescracker.com › python › program › python-insert-element-in-list.htm
Python Program to Insert an Element in a List
Here is its sample run with user ... element to store in the list: Note: To follow the position's value, use the nums.insert((pos+1), elem) statement to insert an element at the given position....
🌐
C# Corner
c-sharpcorner.com › article › python-list-insertions-explained-from-single-elements-to-bulk-and-conditional-r
Python List Insertions Explained: From Single Elements to Bulk and Conditional Regions
September 29, 2025 - Assigning to arr[i:j] with a different-length list replaces the slice. Sometimes you don’t know the index — you know the value condition. For example: “Insert 99 after every value greater than 50.” · This requires traversal + conditional insertion. def insert_after_greater(arr, threshold, value_to_insert): """Insert value_to_insert immediately after every element > threshold.""" i = 0 while i < len(arr): if arr[i] > threshold: arr.insert(i + 1, value_to_insert) i += 2 # Skip the inserted element else: i += 1 return arr data = [10, 60, 20, 70, 30] insert_after_greater(data, 50, 99) print(data) # [10, 60, 99, 20, 70, 99, 30]
🌐
Vultr Docs
docs.vultr.com › python › standard-library › list › insert
Python list insert() - Insert Element | Vultr Docs
November 11, 2024 - This script demonstrates inserting multiple characters into a list to ensure they are in alphabetical order. The tuple ('b', 1) means insert 'b' at index 1, and similarly, 'c' at index 2. Always specify index 0 when the list is empty, regardless of what the intended index might be. ... The only valid index for an empty list is 0. Attempting to insert into any other index will have no negative effect but is logically incorrect. Python allows using an index value greater than the list length, which effectively appends the element to the end.
🌐
IONOS
ionos.com › digital guide › websites › web development › python insert
How to use Python insert to insert elements in a list
November 2, 2023 - These include the Python insert method, which lets you insert a single element into an existing Python list. To add multiple elements to the list at once or append single elements at the end, the Python extend and Python append methods are useful.