Skip to content
Advertisement

All combinations of a list of lists [duplicate]

I’m basically looking for a python version of Combination of List<List<int>>

Given a list of lists, I need a new list that gives all the possible combinations of items between the lists.

JavaScript

The number of lists is unknown, so I need something that works for all cases. Bonus points for elegance!

Advertisement

Answer

you need itertools.product:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement