You can download this code by clicking the button below.
This code is now available for download.
The function is similar to zip(), but it combines multiple iterable objects and extends the shortest one with a specified fill value if necessary.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*iterables, fillvalue=None):
"""Like zip(), but the shortest iterable is extended by fillvalue."""
from itertools import zip_longest
return zip_longest(*iterables, fillvalue=fillvalue)