python every combination of a list code example
Example 1: get all combinations from two lists python
a = ["foo", "melon"]
b = [True, False]
c = list(itertools.product(a, b))
>> [("foo", True), ("foo", False), ("melon", True), ("melon", False)]
Example 2: python get all combinations of list
itertools.combinations(iterable, r)
Example 3: how to get all possible combinations in python
all_combinations = [list(zip(each_permutation, list2)) for each_permutation in itertools.permutations(list1, len(list2))]