Combining Iterables with FillValue

  • Share this:

Code introduction


The function combines multiple iterable objects into an iterator. If an iterable has fewer elements than the others, it fills with the fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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