append() adds a single element to the end of a Python array or list.

  • For array.array (from the array module), use arr.append(element) to add one item. The element must match the array's data type (e.g., 'i' for integers). Adding a mismatched type raises a TypeError.

  • For lists, use list.append(element) to add one item. Lists accept mixed data types.

  • To add multiple elements from another array or list, use extend() instead of append().

  • For NumPy arrays, use numpy.append() to create a new array with values appended. It returns a copy and does not modify the original array. Use axis to specify appending along a dimension.

Example:

import array
arr = array.array('i', [1, 2, 3])
arr.append(4)  # Adds integer 4
print(arr)     # Output: array('i', [1, 2, 3, 4])

You can append the elements of one list to another with the "+=" operator. Note that the "+" operator creates a new list.

a = [1, 2, 3]
b = [10, 20]

a = a + b # Create a new list a+b and assign back to a.
print a
# [1, 2, 3, 10, 20]


# Equivalently:
a = [1, 2, 3]
b = [10, 20]

a += b
print a
# [1, 2, 3, 10, 20]

If you want to append the lists and keep them as lists, then try:

result = []
result.append(a)
result.append(b)
print result
# [[1, 2, 3], [10, 20]]
Answer from stackoverflowuser2010 on Stack Overflow
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-array
Python Array Add: How to Append, Extend & Insert Elements | DigitalOcean
April 15, 2025 - Learn how to add elements to an array in Python using append(), extend(), insert(), and NumPy functions. Compare performance and avoid common errors.
Discussions

Append method not working
I ran a simple python code on jupyter notebook for just testing the append method It is not working. It gives none as output. The code is as given below. List = [1,2,3,4] Newlist = List.append(7) print(Newlist) Output:- None I am new to python so please help me with this code and correct the ... More on discuss.python.org
🌐 discuss.python.org
0
April 8, 2023
Append and write to an array?
x.append() will modify the list, I don't understand what you mean by "code itseld is unaffected" More on reddit.com
🌐 r/learnpython
7
1
September 28, 2022
What is Python's list.append() method WORST Time Complexity? It can't be O(1), right?
I've read on Stackoverflow that in Python Array doubles in size when run of space It's actually not double, but it does increase proportional to the list size (IIRC it's about 12%, though there's some variance at smaller sizes). This does result in the same asymptotics though, so I'll assume doubling in the following description for simplicity. So basically it has to copy all addresses log(n) times. Not quite. Suppose we're appending n items to an empty vector. We will indeed do log(n) resizes, so you might think "Well, resizes are O(n), so log(n) resizes is n log(n) operations, which if we amortize over the n appends we did means n log(n)/n, or log(n) per append". However, there's a flaw in this analysis: we do not copy "all addresses" each of those times. Ie. the copies are not O(n). Sure, the last copy we do will involve copying n items, but the one before it only copied n/2, and so on. So we actually do 1 + 2 + 4 + ... + n copies, which sums to 2n-1. Divide that by n and you get ~2 operations per append - a constant. I assume since it copies addresses, not information We are indeed only copying the pointer, but this doesn't really matter for the complexity analysis. Even if it was copying a large structure, that'd only increase the time by a constant factor. Does that mean that O(1) is the average time complexity? It's the amortized worst case complexity (ie. what happens over a large number of operations). While any one operation can indeed end up doing O(n) operations, there's an important distinction that over a large number of operations, you are guaranteed to only be O(1), which is a distinction just talking about average case wouldn't capture. More on reddit.com
🌐 r/learnpython
11
3
October 26, 2022
Numpy Array Append
Just so you know: A numpy array is not made to be appended to like a list is. In the background of np.append an entire new array has to be created, so it's expensive (slow). It's much better to use lists if you need to append data. More on reddit.com
🌐 r/learnpython
5
1
February 14, 2019
🌐
W3Schools
w3schools.com › python › gloss_python_array_add.asp
Python Add Array Item
Python Examples Python Compiler ... Q&A Python Bootcamp Python Certificate Python Training ... You can use the append() method to add an element to an array....
🌐
freeCodeCamp
freecodecamp.org › news › append-in-python-how-to-append-to-a-list-or-an-array
Append in Python – How to Append to a List or an Array
January 7, 2022 - In this article, you'll learn about the .append() method in Python. You'll also see how .append() differs from other methods used to add elements to lists. Let's get started! An array in programming is an ordered collection of items, and all items need to be of the same data type.
🌐
Quora
quora.com › How-do-I-add-to-an-array-in-Python
How to add to an array in Python - Quora
Answer (1 of 3): I am assuming you’re talking about “Lists” in python. You can append/add data to a list in python with the “append” method. Eg: arrList.append(“data”). You may want to check out 5. Data Structures - Python 3.9.4 documentation
🌐
Python documentation
docs.python.org › 3 › reference › datamodel.html
3. Data model — Python 3.14.3 documentation
Extension modules (written in C, Java, or other languages, depending on the implementation) can define additional types. Future versions of Python may add types to the type hierarchy (e.g., rational numbers, efficiently stored arrays of integers, etc.), although such additions will often be provided via the standard library instead.
Find elsewhere
🌐
Python.org
discuss.python.org › python help
Append method not working - Python Help - Discussions on Python.org
April 8, 2023 - I ran a simple python code on jupyter notebook for just testing the append method It is not working. It gives none as output. The code is as given below. List = [1,2,3,4] Newlist = List.append(7) print(Newlist) Out…
🌐
W3Schools
w3schools.com › python › python_arrays.asp
Python Arrays
You can use the append() method to add an element to an array. ... You can use the pop() method to remove an element from the array. ... You can also use the remove() method to remove an element from the array.
🌐
Centron
centron.de › startseite › numpy.append() in python – tutorial
numpy.append() in Python - Tutorial
February 7, 2025 - The Python numpy.append() function allows for array concatenation and is especially useful when processing data efficiently. It returns a new array while keeping the original array unchanged.
🌐
Namehero
namehero.com › blog › how-to-append-an-item-to-a-python-array
How to Append an Item to a Python Array
April 17, 2024 - To explicitly use arrays instead of lists in Python, you need to import the “array” module. Here’s a series of commands designed to show you how to create an array, append an item to it, and print the output:
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.append.html
numpy.append — NumPy v2.5.dev0 Manual
Delete elements from an array. ... Try it in your browser! >>> import numpy as np >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) array([1, 2, 3, ..., 7, 8, 9])
🌐
w3resource
w3resource.com › numpy › manipulation › append.php
Numpy: numpy.append() function - w3resource
May 29, 2024 - NumPy Array manipulation: numpy.append() function, example - The append() function is used to append values to the end of an given array.
🌐
W3Schools
w3schools.com › python › python_lists_add.asp
Python - Add List Items
To append elements from another list to the current list, use the extend() method.
🌐
Mimo
mimo.org › glossary › python › append()
Python List append Method: Dynamic List Expansion | Learn Now
When collecting or generating data in a loop, append() can add an element at a time to a list. Once you’ve created a list using square brackets ([]), you can use the append() method on it. This use case is beneficial for beginners learning how to manipulate lists in Python.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.append.html
numpy.append — NumPy v2.1 Manual
Delete elements from an array. ... >>> import numpy as np >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]]) array([1, 2, 3, ..., 7, 8, 9])
🌐
Note.nkmk.me
note.nkmk.me › home › python
Add an Item to a List in Python: append, extend, insert | note.nkmk.me
April 17, 2025 - In Python, you can add a single item (element) to a list using append() and insert(). You can combine lists using extend(), +, +=, and slicing. Add an item to a list: append() Combine lists: extend(), ...
🌐
NumPy
numpy.org › doc › stable › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.4 Manual
After installing NumPy, it may be imported into Python code like: ... This widespread convention allows access to NumPy features with a short, recognizable prefix (np.) while distinguishing NumPy features from others that have the same name. Throughout the NumPy documentation, you will find blocks that look like: >>> a = np.array([[1, 2, 3], ...
🌐
Real Python
realpython.com › python-append
Python's .append(): Add Items to Your Lists in Place – Real Python
October 21, 2023 - Other Python data structures also implement .append(). The operating principle is the same as the traditional .append() in a list. The method adds a single item to the end of the underlying data structure. However, there are some subtle differences. In the next two sections, you’ll learn how .append() works in other data structures, such as array.array() and collections.deque().
🌐
Tutorialspoint
tutorialspoint.com › home › python › python array append method
Python Array Append Method
February 21, 2009 - Python Array append() method is used to add an element to the existing array.