











Python | Convert list of tuples into list
Convert a list of tuples into list in Python :
Given a list of tuples, write a Python program to convert it into a list. we can perform this operation using various Methods.
Example :
- a=[ ( 1, 2) , ( 3 ,4) ]
- a = [1,2,3,4 ]


Below are methods to convert list of tuples into a list in Python .
Code #1 :
#Python Program
#rishikesh
# Python code to convert list of tuples into list
# List of tuple initialization
lt = [(‘A’, 2), (‘B’, 4), (‘C’, ‘6’)]
# using list comprehension
liout = [item for t in lt for item in t]
# printing output
print(‘The List is : ‘ , liout)
Output :
The List is : ['A', 2, 'B', 4, 'C', '6']
Code #2:
#Python Program
#rishikesh
# Python code to convert list of tuples into list
import itertools
# List of tuple
tup = [(‘A’, 2), (‘B’, 4), (5, 6)]
# Using itertools
liout = list(itertools.chain(*tup))
# printing output
print(“The list is :” ,liout)
Output :
The list is : ['A', 2, 'B', 4, 5, 6]
Code #3 :
#Python Program
#rishikesh
# Python code to convert list of tuples into list
# List of tuple
tup = [(‘A’, 2), (‘B’, 4), (5, 6)]
# Using itertools
liout = []
for i in tup:
for j in i:
liout.append(j)
# printing output
print(“The list is :” ,liout)
Output :
The list is : ['A', 2, 'B', 4, 5, 6]
Code #4
#Python Program
#rishikesh
# Python code to convert list of tuples into list
# List of tuple
tup = [(‘A’, 2), (‘B’, 4), (5, 6)]
# Using map for 0 index
b = map(lambda x: x[0], tup)
# Using map for 1 index
c = map(lambda x: x[1], tup)
# converting to list
b = list(b)
c = list(c)
# Combining output
liout = b + c
print(“The list is :” ,liout)
Output :
The list is : ['A', 'B', 5, 2, 4, 6]
Code #5 :
#Python Program
#rishikesh
# Python code to convert list of tuples into list
# List of tuple
tup = [(‘A’, 2), (‘B’, 4), (5, 6)]
# using sum function()
liout = list(sum(tup, ()))
print(“The list is :” ,liout)
Output :
The list is : ['A', 2, 'B', 4, 5, 6]
Code #6 :
#Python Program
#rishikesh
# Python code to convert list of tuples into list
import operator
from functools import reduce
# List of tuple
tup = [(‘A’, 2), (‘B’, 4), (5, 6)]
print(“The list is :” ,(list(reduce(operator.concat, tup))))
Output :
The list is : ['A', 2, 'B', 4, 5, 6]
Login/Signup to comment