• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
PythonForBeginners.com

PythonForBeginners.com

Learn By Example

  • Home
  • Learn Python
    • Python Tutorial
  • Categories
    • Basics
    • Lists
    • Dictionary
    • Code Snippets
    • Comments
    • Modules
    • API
    • Beautiful Soup
    • Cheatsheet
    • Games
    • Loops
  • Python Courses
    • Python 3 For Beginners
You are here: Home / Basics / Tuple to List in Python

Tuple to List in Python

Author: Aditya Raj
Last Updated: April 22, 2023

We use lists and tuples in Python if we want random access to sequential data. However, lists and tuples have a fundamental difference. Tuples in Python are immutable while we can manipulate lists in Python. In this article, we will discuss how to convert a tuple to a list in Python.

Table of Contents
  1. Tuple to List in Python Using For Loop
  2. Convert Tuple to List Using The extend() Method
  3. Tuple to List Using List Comprehension in Pythn
  4. Using the List() Function in Python
  5. Conclusion

Tuple to List in Python Using For Loop

To convert a list to a tuple in Python, we can use a for loop and the append() method. For this, we will use the following approach.

  • First, we will create an empty list named output_list. 
  • After creating the empty list, we will iterate through the elements of the tuple using a for loop.
  • While iteration, we will append each element of the tuple to output_list. For this, we will invoke the append() method on output_list and pass the elements of the tuple as input arguments. After execution of the append() method, the elements are added to output_list.

After execution of the for loop, we will get the list created from the tuple. You can observe this in the following example.

myTuple=(11,2,44,21,15,4,23,12)
output_list=[]
for element in myTuple:
    output_list.append(element)
print("The original tuple is:")
print(myTuple)
print("The output list is:")
print(output_list)

Output:

The original tuple is:
(11, 2, 44, 21, 15, 4, 23, 12)
The output list is:
[11, 2, 44, 21, 15, 4, 23, 12]

Convert Tuple to List Using The extend() Method

Instead of using the for loop and the append() method, we can also use the extend() method to convert a tuple into a list.  The extend() method takes an iterable object as its input argument and adds all the elements of the input object to the list. To convert a tuple to a list using the extend() method, we will use the following steps.

  • First, we will create an empty list output_list to store the output list.
  • Next, we will invoke the extend() method on output_list. The extend() method takes the tuple as its input argument. After execution, it will add all the elements of the tuple to the list.

After execution of the extend() method, we will get the output list. You can observe this in the following example.

myTuple=(11,2,44,21,15,4,23,12)
output_list=[]
output_list.extend(myTuple)
print("The original tuple is:")
print(myTuple)
print("The output list is:")
print(output_list)

Output:

The original tuple is:
(11, 2, 44, 21, 15, 4, 23, 12)
The output list is:
[11, 2, 44, 21, 15, 4, 23, 12]

Tuple to List Using List Comprehension in Pythn

List comprehension is used to create lists from existing iterable objects in Python. We can also use it to convert the tuple into a list as shown below.

myTuple=(11,2,44,21,15,4,23,12)
output_list=[element for element in myTuple]
print("The original tuple is:")
print(myTuple)
print("The output list is:")
print(output_list)

Output:

The original tuple is:
(11, 2, 44, 21, 15, 4, 23, 12)
The output list is:
[11, 2, 44, 21, 15, 4, 23, 12]

Using the List() Function in Python

Python also provides us with the list() function to directly convert an iterable object into a list. We can pass the tuple to the list() function to convert it into a list as shown below.

myTuple=(11,2,44,21,15,4,23,12)
output_list=list(myTuple)
print("The original tuple is:")
print(myTuple)
print("The output list is:")
print(output_list)

Output:

The original tuple is:
(11, 2, 44, 21, 15, 4, 23, 12)
The output list is:
[11, 2, 44, 21, 15, 4, 23, 12]

Conclusion

In this article, we discussed different ways to convert a tuple to a list in Python. To learn more about Python programming, you can read this article on pandas where method. You might also like this article on how to convert a string to a variable name in Python.

I hope you enjoyed reading this article. Stay tuned for more informative articles.

Happy Learning!

Related

Recommended Python Training

Course: Python 3 For Beginners

Over 15 hours of video content with guided instruction for beginners. Learn how to create real world applications and master the basics.

Enroll Now

Filed Under: Basics Author: Aditya Raj

More Python Topics

API Argv Basics Beautiful Soup Cheatsheet Code Code Snippets Command Line Comments Concatenation crawler Data Structures Data Types deque Development Dictionary Dictionary Data Structure In Python Error Handling Exceptions Filehandling Files Functions Games GUI Json Lists Loops Mechanzie Modules Modules In Python Mysql OS pip Pyspark Python Python On The Web Python Strings Queue Requests Scraping Scripts Split Strings System & OS urllib2

Primary Sidebar

Menu

  • Basics
  • Cheatsheet
  • Code Snippets
  • Development
  • Dictionary
  • Error Handling
  • Lists
  • Loops
  • Modules
  • Scripts
  • Strings
  • System & OS
  • Web

Get Our Free Guide To Learning Python

Most Popular Content

  • Reading and Writing Files in Python
  • Python Dictionary – How To Create Dictionaries In Python
  • How to use Split in Python
  • Python String Concatenation and Formatting
  • List Comprehension in Python
  • How to Use sys.argv in Python?
  • How to use comments in Python
  • Try and Except in Python

Recent Posts

  • Count Rows With Null Values in PySpark
  • PySpark OrderBy One or Multiple Columns
  • Select Rows with Null values in PySpark
  • PySpark Count Distinct Values in One or Multiple Columns
  • PySpark Filter Rows in a DataFrame by Condition

Copyright © 2012–2025 · PythonForBeginners.com

  • Home
  • Contact Us
  • Privacy Policy
  • Write For Us