You can download this code by clicking the button below.
This code is now available for download.
The `zip_longest` function is similar to `zip`, but it merges lists of different lengths, filling missing values with `fillvalue`.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=()):
"""
Like zip(), but merges lists of different lengths, filling missing values with fillvalue.
"""
from itertools import zip_longest as it_zip_longest
return list(it_zip_longest(*args, fillvalue=fillvalue))