Latest web development tutorials

Python List list () method

Python list Python list


description

list () method is used to convert a tuple list.

NOTE: tuples and lists are very similar, except that the element values can not modify tuples, tuples are in brackets, the list is put in square brackets.

grammar

list () method syntax:

list( seq )

parameter

  • list - the list to be converted to a tuple.

return value

Back to list.

Examples

The following examples show the list () function to use:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

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

print "列表元素 : ", aList

Examples of the above output results are as follows:

列表元素 :  [123, 'xyz', 'zara', 'abc']

Python list Python list