How to undo a transpose with zip

  python, python-3.8

I am working on a list containing of tuples like

list = [(1, 2, 3, 4), (5, 6, 7, 8), (9, 10, 11, 12)]

and transpose it

transpose = zip(*list)

so i get

transpose = [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]

after that i am removing some of the tuples of the transponed list for example the second tuple (2, 6, 10). How can i undo the transpose now? I want to achieve a list like:

[(1, 3, 4), (5, 7, 8), (9, 11, 12)]

Source: Python Questions

LEAVE A COMMENT