Python List Append() Syntax
List_name.append(element)
Parameter
- element: an element (number, string, list, etc.) to be added at the end of the list. The parameter is mandatory and omitting it can cause an error.
Python List append() Method
Python list append() method is used to add elements at the end of the list.
Example
Python
list = [ 2 , 5 , 6 , 7 ] list .append( 8 ) print ( list ) |
Output
[2, 5, 6, 7, 8]