Python List append() Method with Examples

The list.append()method in Python is used to append an item to the end of a list. It modifies the original list in place and returns None (meaning no value/object is returned). The item being added can be of any data type, including a string, integer, or iterable like a dictionary, set, tuple, or even another list. When you append an iterable, it appends as a single element (for example appending a list results in a nested list).


In this article, I will explain the syntax of the python list append() method, its parameters and explain how to use it.

1. Quick Examples of List append() Function

If you are in a hurry, below are some quick examples of using the list append() function.

# Below are the quick examples

# Example 1: Append an item to the list
technology = ['Spark', 'Python', 'Pyspark']

# Example 2: Use append() function 
# Appends list to the list 
technology = ['Java', 'Spark', 'Python']
technology1 = ['Hyperion', 'Pandas', 'Pyspark']

# Example 3: Append tuple to the list 
technology = ['Java', 'Spark', 'Python']
technology1 = ('Hyperion', 'Pandas', 'Pyspark')

2. Syntax of list.append() Function

Following is a syntax of the append() function.

# Syntax of list.append() function

2.1 Parameters of append()

  • item – The item to be appended to the list. It can be of any data type (e.g. string, integer, list, etc.).

2.2 Return Value

This function does not return any value but updates the existing list.

3. List append() Function Example

Use list.append() to append an item or element to a list, (element can be a string, list e.t.c). For example, if you have a list called technology and you want to append an element 'Hadoop' at the end, use this function. Here, is an example.

# Consider a list
technology = ['Spark', 'Python', 'Pyspark']
print("Actual List",technology)

# Add 'Hadoop' to the list
print("Updated List: ",technology)

This example yields the below output.

python list append

4. Append List using append() Function

You can also use the append() function to append another list to a list in Python. For example, the append() function is used to append list technology1 to the list technology. Now technology contains the elements of the original list and the new list, which is a nested list.

# Use append() function to add list to the list 
technology = ['Java', 'Spark', 'Python']
technology1 = ['Hyperion', 'Pandas', 'Pyspark']

# Output
# ['Java', 'Spark', 'Python', ['Hyperion', 'Pandas', 'Pyspark']]

Similarly, you can also append a list, set, tuple e.t.c to the list.

5. Other Ways to Append Element to List

5.1 Example 1

You can also use the list.extend() method to append the elements of one list to another. This will append the elements of the list to the end of the existing list. By using this you can append multiple elements to the list.

# Use extend() function to add list to the list 
technology = ['Java', 'Spark', 'Python']
technology1 = ['Hyperion', 'Pandas', 'Pyspark']

# Using extend

# Output
# ['Java', 'Spark', 'Python', 'Hyperion', 'Pandas', 'Pyspark']

Similarly, if you want to add list to a single list, you can use for loop and append each element of the list to the existing list.

# Use extend() function
lists = [[3, 5], [4, 6], [2, 8]]
list1 = []
for lst in lists:

# Output
# [3, 5, 4, 6, 2, 8]

5.2 Example 2

You can also use the += operator.

# use the += operator
technology = ['Spark', 'Python']
technology1 = ['Pandas', 'Pyspark']
technology += technology1

# Output
# ['Spark', 'Python', 'Pandas', 'Pyspark']

Alternatively, you can also use the + operator to append two lists. For example, you can create a new list that contains the elements of technology and 'Hyperion'.

# Use * operator
technology = ['Spark','Python','Pyspark']
technology = technology + ['Hyperion']

# Output
# ['Spark','Python','Pyspark','Hyperion']

5.3 Example 3

Use the list.insert() method to insert an element at a specific index in the list. For example, you can insert 'Java' at the first position of the list. For more examples, refer to add element to list by index.

# Use insert() function
technology = ['Spark','Python','Pyspark']
technology.insert(0, 'Java')

# Output
# ['Java', 'Spark', 'Python', 'Pyspark']

You can also use list comprehension to append an item to the list.

# use list comprehension
technology = ['Spark','Python','Pyspark']
technology = [x for x in technology] + ['Pandas']

# Output
# ['Spark', 'Python', 'Pyspark', 'Pandas']


In this article, I have explained the python list append() method syntax, parameters, and how to use it to append an element to the list at the end. Also, learned other ways to append elements.

Happy Learning !!


Malli is an experienced technical writer with a passion for translating complex Python concepts into clear, concise, and user-friendly articles. Over the years, he has written hundreds of articles in Pandas, NumPy, Python, and takes pride in ability to bridge the gap between technical experts and end-users.

Leave a Reply

You are currently viewing Python List append() Method with Examples