Is there a built-in function that works like zip() but that will pad the results so that the length of the resultant list is the length of the longest input rather
def zip_longest(*lists):
def g(l):
for item in l:
yield item
while True:
yield None
gens = [g(l) for l in lists]
for _ in range(max(map(len, lists))):
yield tuple(next(g) for g in gens)