All combinations of a list of lists

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.

[[1,2,3],[4,5,6],[7,8,9,10]] -> [[1,4,7],[1,4,8],...,[3,6,10]]

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

9 Answers
9

Leave a Comment