Open this example in the interactive library
Source code
from itertools import zip_longest
print(list(zip_longest([1, 2, 3], ['a'], fillvalue='missing')))Sample output
[(1, 'a'), (2, 'missing'), (3, 'missing')]

Zip with missing values. A self-contained example using the Python standard library.
Open this example in the interactive library
from itertools import zip_longest
print(list(zip_longest([1, 2, 3], ['a'], fillvalue='missing')))[(1, 'a'), (2, 'missing'), (3, 'missing')]