import itertools list1 = list(range(5, 10)) list2 = [1, 2, 3] list = [list1, list2] combination = [p for p in itertools.product(*list)] print(combination) PythonCopy