
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How do I convert between tuples and lists in Python?
First, we will see how to convert Tuple into a List in Python.
Convert Tuple with Integer Elements into a List
To convert Tuple to a List, use the list() method and set the Tuple to be converted as a parameter.
Example
Let’s see the example
# Creating a Tuple mytuple = (20, 40, 60, 80, 100) # Displaying the Tuple print("Tuple = ",mytuple) # Length of the Tuple print("Tuple Length= ",len(mytuple)) # Tuple to list mylist = list(mytuple) # print list print("List = ",mylist) print("Type = ",type(mylist))
Output
Tuple = (20, 40, 60, 80, 100) Tuple Length= 5 List = [20, 40, 60, 80, 100] Type = <class 'list'>
Convert Tuple with String Elements into a List
To convert Tuple to a List, use the list() method and set the Tuple with string elements to be converted as a parameter.
Example
Let’s see the example
# Creating a Tuple mytuple = ("Jacob", "Harry", "Mark", "Anthony") # Displaying the Tuple print("Tuple = ",mytuple) # Length of the Tuple print("Tuple Length= ",len(mytuple)) # Tuple to list mylist = list(mytuple) # print list print("List = ",mylist) print("Type = ",type(mylist))
Output
Tuple = ('Jacob', 'Harry', 'Mark', 'Anthony') Tuple Length= 4 List = ['Jacob', 'Harry', 'Mark', 'Anthony'] Type = <class 'list'>
Convert List to Tuple
To convert List to Tuple, use the tuple() −
Example
# Creating a List mylist = ["Jacob", "Harry", "Mark", "Anthony"] # Displaying the List print("List = ",mylist) # Convert List to Tuple res = tuple(mylist) print("Tuple = ",res)
Output
List = ['Jacob', 'Harry', 'Mark', 'Anthony'] Tuple = ('Jacob', 'Harry', 'Mark', 'Anthony')
- Related Articles
- What's the difference between lists and tuples in Python?
- What are the differences and similarities between tuples and lists in Python?
- Remove duplicate lists in tuples (Preserving Order) in Python
- How do we define lists in Python?
- How do we compare two tuples in Python?
- How do I convert between big-endian and little-endian values in C++?
- Difference between List and Tuples in Python.
- How do we compare two lists in Python?
- How To Do Math With Lists in python ?
- Why does Python allow commas at the end of lists and tuples?
- How do I convert a string to a number in Python?
- How do I convert a number to a string in Python?
- Convert dictionary to list of tuples in Python
- Convert list of tuples into digits in Python
- Convert list of tuples into list in Python

Advertisements