You can download this code by clicking the button below.
This code is now available for download.
The zip_longest function from the itertools module combines multiple iterable objects. If one of the iterable objects is shorter than the others, it fills the remaining positions with a fillvalue.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*iterables, fillvalue=None):
# zip_longest function from itertools module which fills missing values with fillvalue
from itertools import zip_longest
return list(zip_longest(*iterables, fillvalue=fillvalue))