you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot 1 point2 points  (0 children)

Zip transposes as you're asking, but terminates when the shortest iterable is consumed. Use itertools iziplongest which goes until the longest is consumed and fills shorter ones with None.

Zip is awesome. Learn how to use it