You can download this code by clicking the button below.
This code is now available for download.
The function accepts any number of iterable objects as input and uses the built-in zip_longest function to merge them. If the input iterators have different lengths, the fillvalue is used to fill in the missing values.
Technology Stack : Built-in function zip_longest
Code Type : Iterator
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=None):
zip_longest = zip_longest(*args, fillvalue=fillvalue)
for i in zip_longest:
yield i
# JSON output