Copyright © tutorialspoint.com

Python List list() Function

previous next


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:

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

Copyright © tutorialspoint.com