Combining Iterables with Fillvalue

  • Share this:

Code introduction


The function combines multiple iterable objects together. If the iterables are of unequal lengths, the missing parts are filled with the fillvalue.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*args, fillvalue=0):
    from itertools import zip_longest as _zip_longest

    return _zip_longest(*args, fillvalue=fillvalue)                
              
Tags: