您可以itertools.chain.from_iterable
像这样简单地使用扁平化内部元组
for product in p: print tuple(itertools.chain.from_iterable(product))
例如,
>>> from itertools import chain, product >>> [tuple(chain.from_iterable(prod)) for prod in product(*lists)] [(1, 4), (1, 5), (1, 6), (2, 4), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6)]