Latest web development tutorials

Python List append () method

Python list Python list


description

append () method is used at the end of the list to add new objects.

grammar

append () method syntax:

list.append(obj)

parameter

  • obj - the object added to the end of the list.

return value

This method returns no value, but will modify the original list.

Examples

The following example shows the append () method using the function:

#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc'];
aList.append( 2009 );
print "Updated List : ", aList;

Examples of the above output results are as follows:

Updated List :  [123, 'xyz', 'zara', 'abc', 2009]

Python list Python list