Combining Iterables with FillValue

  • Share this:

Code introduction


The `zip_longest` function combines iterables together. If the iterables are of unequal length, `fillvalue` is used to fill the shorter iterables.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*iterables, fillvalue=None):
    from itertools import zip_longest as _zip_longest

    return _zip_longest(*iterables, fillvalue=fillvalue)                
              
Tags: