I'm trying to zip two lists of different lengths in Python so the items in the the second one are zipped iteratively over the elements in the first one.
I have tried using itertools.product
without much luck. Is it possible to achieve this with some module in the standard library?
E.g
import itertools
a = ["a", "b", "c", "d", "e", "f"]
b = [1, 2, 3]
list(itertools.product(a, b))
Result:
[('a', 1),
('a', 2),
('a', 3),
('b', 1),
('b', 2),
('b', 3),
('c', 1),
('c', 2),
('c', 3)
[...],
Desired result:
[('a', 1),
('b', 2),
('c', 3),
('d', 1),
('e', 2),
('f', 3)]