SoFunction
Updated on 2024-12-13

Manipulating Lists in Python with Methods

The append() method appends the passed obj to the existing list.
grammatical

The following is the syntax of the append() method:

(obj)

parameters

  • obj -- This is the object to append to the list.

return value

This method does not return any value, but updates the existing list.
(for) instance

The following example shows the use of the append() method.

#!/usr/bin/python

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

When we run the above program, it produces the following results:

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