You can download this code by clicking the button below.
This code is now available for download.
Create an iterator that aggregates elements from each of the iterables. If the iterables are of uneven length, missing values are filled with fillvalue.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=0):
zip_longest = itertools.zip_longest(*args, fillvalue=fillvalue)
return [list(pair) for pair in zip_longest]