Python List append() Method
Example
Add an element to the fruits
list:
fruits = ['apple', 'banana', 'cherry']
fruits.append("orange")
Try it Yourself »
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)
Try it Yourself »
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.