Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python List list() Function
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:
Parameters:
Here is the detail of parameters:
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']
|
|
|
|