You can download this code by clicking the button below.
This code is now available for download.
The function merges multiple iterable objects into an iterator. If the longest iterable is exhausted, it fills the remaining iterables with the fillvalue.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=0):
from itertools import zip_longest as zl
return zl(args, fillvalue=fillvalue)