Combining Iterables with Fillvalue

  • Share this:

Code introduction


This function combines iterable objects into tuples. If one of the iterable objects is exhausted, fillvalue is used to fill in.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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