Python‎ > ‎itertools‎ > ‎

itertools.zip_longest()

http://www.adilwaseem.com/

Definition
Return an zip_longest object whose .__next__() method returns a tuple where the i-th element comes from the i-th iterable argument.

Syntax
zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object

Parameters
iterable(range)

Example
The return is equal to following:
 >>> list(itertools.zip_longest(range(1,5), range(1,10)))
[(1, 1), (2, 2), (3, 3), (4, 4), (None, 5), (None, 6), (None, 7), (None, 8), (None, 9)]
>>>


Comments