All combinations of a list of lists

后端 未结 7 1617
离开以前
离开以前 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:49

    from itertools import product 
    list_vals = [['Brand Acronym:CBIQ', 'Brand Acronym :KMEFIC'],['Brand Country:DXB','Brand Country:BH']]
    list(product(*list_vals))
    

    Output:

    [('Brand Acronym:CBIQ', 'Brand Country :DXB'),
    ('Brand Acronym:CBIQ', 'Brand Country:BH'),
    ('Brand Acronym :KMEFIC', 'Brand Country :DXB'),
    ('Brand Acronym :KMEFIC', 'Brand Country:BH')]

提交回复
热议问题