You can download this code by clicking the button below.
This code is now available for download.
This function zips together multiple iterable objects (such as lists, tuples, etc.) into a single iterable. It stops when the shortest input iterable is exhausted, and missing values are filled with fillvalue.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=None):
"""
Zip together multiple iterables (sequences) into a single iterable (sequence).
The iterator stops when the shortest input iterable is exhausted, and missing values are filled with fillvalue.
"""
from itertools import zip_longest as _zip_longest
return _zip_longest(*args, fillvalue=fillvalue)