Imagine a list of lists, like this:
x=[['foo','bar'],['baz'],['xyz']]
Except longer. I need a script to generate permutations for a list of arbitrary length containing small sets of words, also of arbitrary length.
So, in this case:
[['foo','bar'],['baz'],['xyz']]
[['foo','bar'],['xyz'],['baz']]
[['xyz'],['baz'],['foo','bar']]
[['baz'],['xyz'],['foo','bar']]
[['xyz'],['foo','bar'],['baz']]
[['baz'],['foo','bar'],['xyz']]
I've not been able to manage this with itertools. Any suggestions?