Python Forum

Full Version: iterating over 2 iterators
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what was the name of that function that would iterate over 2 iterators and let you do:
   for x,y in iter2(xx,yy):
where xx and yy are 2 iterators of presumably the same length (else the iteration stops at the end of the shorter iterator).
https://docs.python.org/3/library/functions.html#zip Wrote:zip(*iterables)
Make an iterator that aggregates elements from each of the iterables.

Returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables. The iterator stops when the shortest input iterable is exhausted. With a single iterable argument, it returns an iterator of 1-tuples. With no arguments, it returns an empty iterator. ...
thanks! that is the function i was looking for. i did remember it had an odd name but i was unable to come up with the right words to find it in the document or on google ("iterators" brings lots of noise).