Python List append() method
Description
The append() method adds a new object to the end of a list.
Syntax
append() method syntax:
list.append(obj)
Parameters
- obj -- the object to add to the end of the list.
Return Value
This method returns nothing, but modifies the original list.
Example
The following example shows how to use the append() function:
#!/usr/bin/python
aList = [123, 'xyz', 'zara', 'abc'];
aList.append( 2009 );
print "Updated List : ", aList;
The output of the above example is:
Updated List : [123, 'xyz', 'zara', 'abc', 2009]
Python Lists