You can download this code by clicking the button below.
This code is now available for download.
This function takes any number of iterable objects as arguments and returns a list of tuples. If the iterables have different lengths, the fillvalue is used to fill the shorter iterables.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=0):
from itertools import zip_longest
return list(zip_longest(*args, fillvalue=fillvalue))