THE WORLD'S LARGEST WEB DEVELOPER SITE

Python List append() Method

❮ List Methods


Example

Add an element to the fruits list:

fruits = ['apple', 'banana', 'cherry']
fruits.append("orange")
Run example »

Definition and Usage

The append() method appends an element to the end of the list.


Syntax

list.append(elmnt)

Parameter Values

Parameter Description
elmnt Required. An element of any type (string, number, object etc.)

More Examples

Example

Add a list to a list:

a = ["apple", "banana", "cherry"]
b = ["Ford", "BMW", "Volvo"]
a.append(b)
Run example »

❮ List Methods