Latest web development tutorials

Python List extend () method

Python list Python list


description

extend () function is used at the end of the list of additional disposable another sequence of a plurality of values ​​(extended the original list with a new list).

grammar

extend () method syntax:

list.extend(seq)

parameter

  • seq - list element.

return value

This method does not return a value, but will add a list of new content in the existing list.

Examples

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

#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc', 123];
bList = [2009, 'manni'];
aList.extend(bList)

print "Extended List : ", aList ;

Examples of the above output results are as follows:

Extended List :  [123, 'xyz', 'zara', 'abc', 123, 2009, 'manni']

Python list Python list