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 list() Function


previous next AddThis Social Bookmark Button


Description:

This function takes sequence types and convert them to lists. This is used to convert a given tuple into list.

Note: Tuple are very similar to lists with only difference that element values of a tuple can not be changed and tuple elements are put between parenthesis instead of square bracket.

Syntax:

list( seq )

Parameters:

Here is the detail of parameters:

  • seq: a tuple to be converted into list.

Return Value:

It returns the list.

Example:

#!/usr/bin/python

aTuple = (123, 'xyz', 'zara', 'abc');
aList = list(aTuple)

print "List elements : ", aList

This will produce following result:

List elements :  [123, 'xyz', 'zara', 'abc']


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names