All combinations of a list of lists

后端 未结 7 1469
离开以前
离开以前 2020-11-22 00:38

I\'m basically looking for a python version of Combination of List>

Given a list of lists, I need a new list that gives all the possible combin

7条回答
  •  鱼传尺愫
    2020-11-22 00:48

    listOLists = [[1,2,3],[4,5,6],[7,8,9,10]]
    for list in itertools.product(*listOLists):
      print list;
    

    I hope you find that as elegant as I did when I first encountered it.

提交回复
热议问题