Python3 List list () method
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/python3 aTuple = (123, 'Google', 'w3big', 'Taobao') list1 = list(aTuple) print ("列表元素 : ", list1) str="Hello World" list2=list(str) print ("列表元素 : ", list2)
Examples of the above output results are as follows:
列表元素 : [123, 'Google', 'w3big', 'Taobao'] 列表元素 : ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']