How to Convert Tuple into List in Python?
[Pages:2]How to Convert Tuple into List in Python?
Python ? Convert Tuple into List
You can convert a Python Tuple ot Python List.
list(sequence) takes any sequence, in this case a tuple, as argument and returns a list object.
Example 1 ? Convert Python Tuple to List
In the following example, we initialize a tuple and convert it to list using list(sequence).
example.py ? Python Program
#initialize tuple aTuple = (True, 28, 'Tiger') #tuple to list aList = list(aTuple) #print list print(type(aList)) print(aList)
Output
[True, 28, 'Tiger']
Example 2 ? Convert Python Tuple to List
In the following example, we initialize a tuple with all integers and convert it to a list using list(sequence).
example.py ? Python Program
#initialize tuple aTuple = (67, 28, 41, 37) #tuple to list aList = list(aTuple) #print list print(type(aList)) print(aList)
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.
Python Programming
Python Tutorial Install Python Install Anaconda Python Python HelloWorld Program Python Variables Python Variable Data Type Conversion Python Comments
Control Statements
Python If Python If Else Python While Loop Python For Loop
Python String
Python String Methods Python String Length Python String Replace Python Split String Python Count Occurrences of Sub-String Python Sort List of Strings
Functions
Python Functions
Python Collections
Python List Python Dictionary
Advanced
Python Multithreading
Useful Resources
Python Interview Questions
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- mit6 0001f16 tuples lists aliasing mutability cloning
- use python with r with reticulate cheat sheet
- how to convert tuple into list in python
- lecture 14 nested lists tuples and dictionaries
- names assignment sequences types lists tuples and
- python quick revision tour
- data structures lists stack queue
- ppyytthhoonn mmoocckk tteesstt iiiiii
- lists tuples files
Related searches
- how to convert fractions into percentages
- how to convert tablespoon into ml
- how to convert binary into text
- how to convert density into mass
- how to convert decimals into fractions steps
- how to convert binary into decimal
- how to convert feet into square feet
- how to convert numbers into binary
- how to convert inches into cubic feet
- how to convert fraction into percent
- how to convert decimal into hex
- how to convert grams into moles