You can download this code by clicking the button below.
This code is now available for download.
This function takes multiple iterable objects and aggregates them into tuples. If the iterables are of uneven length, missing values are filled with the fillvalue.
Technology Stack : itertools
Code Type : Iterator processing
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=0):
# This function takes several iterables and aggregates them into tuples.
# If the iterables are of uneven length, missing values are filled with the fillvalue.
from itertools import zip_longest
return list(zip_longest(*args, fillvalue=fillvalue))