Iterables Combination with Fillvalue

  • Share this:

Code introduction


Combines multiple iterables into a single iterator, filling in missing values from the shortest iterable with the specified fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*args, fillvalue=0):
    from itertools import zip_longest as it_zip_longest

    return it_zip_longest(*args, fillvalue=fillvalue)                
              
Tags: