zip in conjunction with the * operator can be used to unzip a list


In [6]:
x = [1,2,3]
y = [4,5,6]

zipped = zip(x,y)
list(zipped)


Out[6]:
[(1, 4), (2, 5), (3, 6)]

In [9]:
x2,y2 = zip(*zip(x,y))
print(x2)
print(y2)


(1, 2, 3)
(4, 5, 6)

In [ ]: