Combining Iterables with Fillvalue

  • Share this:

Code introduction


Create an iterator that combines multiple iterable objects together. If some iterables are shorter than others, it fills the missing values with a specified fill value.


Technology Stack : itertools

Code Type : Function

Code Difficulty : Intermediate


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

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