Combining Iterables with Fillvalue

  • Share this:

Code introduction


This function combines multiple iterable objects into a new iterator. If an iterable object has fewer elements, it fills with fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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