I would like to generate all combinations of values which are in lists indexed in a dict:
{'A':['D','E'],'B':['F','G','H'],'C':['I','J']}
Each time, one item of each dict entry would be picked and combined to items from other keys, so I have:
['D','F','I']
['D','F','J']
['D','G','I']
['D','G','J']
['D','H','I']
...
['E','H','J']
I know there is a something to generate combinations of items in list in itertools
but I don't think I can use it here since I have different "pools" of values.
Is there any existing solution to do this, or how should I proceed to do it myself, I am quite stuck with this nested structure.
itertools.product(*yourdict.values())
– DevlinD
the first letter, and not... sayF
? – Zellner