Python: Interweave Lists to Tuples, Transpose

By Xah Lee. Date: . Last updated: .

Zip Multiple Lists to Tuples

# example of using zip()

aa = [1, 2, 3, 4]
bb = ["a", "b", "c", "d"]
cc = [10, 20, 30, 40]

print(zip(aa, bb, cc))
# <zip object at 0x106f40b88>

print(list(zip(aa, bb, cc)))
# [(1, 'a', 10), (2, 'b', 20), (3, 'c', 30), (4, 'd', 40)]

Python, Data Structure