How can I match up permutations of a long list with a shorter list (according to the length of the shorter list)? [duplicate]

The simplest way is to use itertools.product:

a = ["foo", "melon"]
b = [True, False]
c = list(itertools.product(a, b))
>> [("foo", True), ("foo", False), ("melon", True), ("melon", False)]

Leave a Comment

tech