Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python List extend() Method


previous next AddThis Social Bookmark Button


Description:

This method appends the contents of seq to list.

Syntax:

list.extend(seq)

Parameters:

Here is the detail of parameters:

  • seq: list of elements

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 Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names