Copyright © tutorialspoint.com

Python List extend() Method

previous next


Description:

This method appends the contents of seq to list.

Syntax:

list.extend(seq)

Parameters:

Here is the detail of parameters:

Return Value:

It returns none but add the content to existing list.

Example:

#!/usr/bin/python

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

print "Extended List : ", aList ;

This will produce following result:

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

previous next

Copyright © tutorialspoint.com