Loop over multiple arrays simultaneously: Difference between revisions

m (Fixed lang tags.)
Line 414:
 
===zip_longest===
Python 3.X has zip_longest which fills shorter iterables with its fillvalue argument which defaults to None:<lang python>>>>(similar fromto itertoolsthe importbehavior zip_longestof ''map()'' in Python 2.x):
<lang python>>>> from itertools import zip_longest
>>> print ( '\n'.join(''.join(x) for x in zip_longest('abc', 'ABCD', '12345', fillvalue='#')) )
aA1
Anonymous user