How to convert list of tuples to multiple lists?

The built-in function zip() will almost do what you want:

>>> list(zip(*[(1, 2), (3, 4), (5, 6)]))
[(1, 3, 5), (2, 4, 6)]

The only difference is that you get tuples instead of lists. You can convert them to lists using

list(map(list, zip(*[(1, 2), (3, 4), (5, 6)])))

Leave a Comment