Combining Iterables with Fillvalue

  • Share this:

Code introduction


This function combines multiple iterable objects. If the iterable objects are of different lengths, it fills the shorter ones with the fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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