Python list method extend() appends the contents of seq to list.
Following is the syntax for extend() method -
list.extend(seq)
This method does not return any value but adds the content to the 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 the above program, it produces the following result -
Extended List : [123, 'xyz', 'zara', 'abc', 123, 2009, 'manni']
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.