Combining Iterables with Fillvalue

  • Share this:

Code introduction


This function combines multiple iterable objects together. If one of the iterable objects is longer than the others, the shorter ones will be filled with `fillvalue`.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


                
                    
def zip_longest(*args, fillvalue=None):
    from itertools import zip_longest as zip_longest_imp

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