Python Function for Combining Iterables with Fillvalue

  • Share this:

Code introduction


The function uses the zip_longest method from the itertools library to combine multiple iterable objects. If the iterable objects are of unequal length, it fills them with fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*args, fillvalue=0):
    from itertools import zip_longest as _zip_longest
    return _zip_longest(*args, fillvalue=fillvalue)                
              
Tags: