Convert list to tuple Python

Python Convert Tuple into List

To convert a tuple into list in Python, call list[] builtin function and pass the tuple as argument to the function. list[] returns a new list generated from the items of the given tuple.

Python list[] builtin function

In this tutorial, we will go through some examples, where we demonstrate how to convert tuple to list in Python.

Examples

Convert Tuple to List

In the following example, we initialize a tuple and convert it to list using list[sequence].

Python Program

#initialize tuple aTuple = [True, 28, 'Tiger'] #tuple to list aList = list[aTuple] #print list print[type[aList]] print[aList]Try Online

Output

[True, 28, 'Tiger']

Convert Tuple of Integers to List

In the following example, we initialize a tuple with all integers and convert it to a list using list[sequence].

Python Program

#initialize tuple aTuple = [67, 28, 41, 37] #tuple to list aList = list[aTuple] #print list print[type[aList]] print[aList]Try Online

Output

[67, 28, 41, 37]

Conclusion

In this Python Tutorial, we learned how to convert a tuple into list in Python using list[sequence], with the help of example Python programs.

Video liên quan

Chủ Đề