Combining Iterables with Fillvalue

  • Share this:

Code introduction


The function combines multiple iterable objects into a new iterable object. If the iterable objects are of different lengths, it fills the shorter ones with a fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*iterables, fillvalue=None):
    from itertools import zip_longest as zip_longest_from_itertools
    return zip_longest_from_itertools(*iterables, fillvalue=fillvalue)                
              
Tags: