You can download this code by clicking the button below.
This code is now available for download.
This function merges multiple iterable objects. If an iterable is shorter, it is filled with the specified fillvalue until the longest iterable is finished.
Technology Stack : itertools
Code Type : Function
Code Difficulty : Intermediate
def zip_longest(*args, fillvalue=None):
# 将多个可迭代对象合并,如果某个可迭代对象较短,则用fillvalue填充
# 使用内置库itertools
from itertools import zip_longest
return list(zip_longest(*args, fillvalue=fillvalue))