Zip Longest Aggregation with Fillvalue

  • Share this:

Code introduction


Creates an iterator that aggregates elements from each of the iterables. If the iterables are of uneven length, missing values are filled-in with a specified value.


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: