Here are the ways to zip two lists of lists in Python:
- Using map() + __add__
- Using itertools.chain() + zip()
- Using list comprehension with extend()
- Using a loop to iterate over both lists and concatenate the sublists
- Using numpy.array() and numpy.concatenate()
- Using list comprehension with unpacking and zip()
Method 1: Using map() + __add__
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
print("The original list 1 is : " + str(list1))
print("The original list 2 is : " + str(list2))
res = list(map(list.__add__, list1, list2))
print("The modified zipped list is : " + str(res))
Output
The original list 1 is : [[11, 31], [41, 51], [15, 16]]
The original list 2 is : [[71, 91], [31, 21], [31, 10]]
The modified zipped list is : [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Method 2: Using itertools.chain() + zip()
import itertools
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
print("The original list 1 is : " + str(list1))
print("The original list 2 is : " + str(list2))
res = [list(itertools.chain(*i))
for i in zip(list1, list2)]
print("The modified zipped list is : " + str(res))
Output
The original list 1 is : [[11, 31], [41, 51], [15, 16]]
The original list 2 is : [[71, 91], [31, 21], [31, 10]]
The modified zipped list is : [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Method 3: Using list comprehension with extend()
import itertools
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
res = [x.extend(y) for x, y in zip(list1, list2)]
print("Original list 1:", list1)
print("Original list 2:", list2)
print("Modified list:", list1)
Output
Original list 1: [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Original list 2: [[71, 91], [31, 21], [31, 10]]
Modified list: [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Method 4: Using a loop to iterate over both lists and concatenate the sublists
import itertools
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
res = []
for i in range(len(list1)):
concatenated_sublist = list1[i] + list2[i]
res.append(concatenated_sublist)
print("The modified zipped list is:", res)
Output
The modified zipped list is: [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Method 5: Using numpy.array() and numpy.concatenate()
import itertools
import numpy as np
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
arr1 = np.array(list1)
arr2 = np.array(list2)
# Concatenating the numpy arrays along axis 1
concatenated_arr = np.concatenate((arr1, arr2), axis=1)
res = concatenated_arr.tolist()
print(res)
Output
[[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
Method 6: Using list comprehension with unpacking and zip()
list1 = [[11, 31], [41, 51], [15, 16]]
list2 = [[71, 91], [31, 21], [31, 10]]
res = [[*x, *y] for x, y in zip(list1, list2)]
# Printing result
print("The modified zipped list is : " + str(res))
Output
The modified zipped list is : [[11, 31, 71, 91], [41, 51, 31, 21], [15, 16, 31, 10]]
That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.