Combining Variable-Length Iterators with Fillvalue

  • Share this:

Code introduction


The function combines variable-length input iterators into a new iterator. If the iterators have different lengths, the fillvalue is used as a padding.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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