You can download this code by clicking the button below.
This code is now available for download.
The function combines multiple iterable objects into an iterator. If an iterable is shorter than the others, it is filled with a specified fillvalue.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=None):
# 将多个可迭代对象组合成一个迭代器,如果某个可迭代对象较短,则用fillvalue填充
from itertools import zip_longest
return zip_longest(*args, fillvalue=fillvalue)