The method extend() appends the contents of seq to list.
Following is the syntax for extend() method:
list.extend(seq)
seq -- This is the list of elements
This method does not return any value but add the content to existing list.
The following example shows the usage of extend() method.
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 123]; bList = [2009, 'manni']; aList.extend(bList) print "Extended List : ", aList ;
When we run above program, it produces following result:
Extended List : [123, 'xyz', 'zara', 'abc', 123, 2009, 'manni']