What does this zip() code mean?

380162267qq at gmail.com 380162267qq at gmail.com
Tue Sep 20 09:19:16 EDT 2016


>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> list(zipped)
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zip(x, y))
>>> x == list(x2) and y == list(y2)
True

My problem is >>> x2, y2 = zip(*zip(x, y)).
zip return an iterator but x2 and y2 are different?
I really need detail explanation about this line.



More information about the Python-list mailing list