You can download this code by clicking the button below.
This code is now available for download.
Create a function that uses `itertools.zip_longest` to combine multiple iterable objects. If the iterators have different lengths, it fills the shorter ones with a `fillvalue`.
Technology Stack : Create a function that uses `itertools.zip_longest` to combine multiple iterable objects. If the iterators have different lengths, it fills the shorter ones with a `fillvalue`.
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=()):
from itertools import zip_longest as itzip_longest
def zip_longest(*args, fillvalue=()):
iterator = itzip_longest(*args, fillvalue=fillvalue)
return list(iterator)
return zip_longest