Combining Iterables with FillValue

  • Share this:

Code introduction


Combines multiple iterables into one iterator. If one iterable is shorter than the others, fillvalue is used to fill in the gaps.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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