Say I have random strings in Python:
>>> X = ['ab', 'cd', 'ef']
What I'd like to do is create all the permutations of the strings (not tuples), i.e.:
['abcdef', 'abefcd', 'cdabef', 'cdefab', 'efabcd', 'efcdab']
list(itertools.permutations(X))
outputs:
[('ab', 'cd', 'ef'), ('ab', 'ef', 'cd'), ('cd', 'ab', 'ef'), ('cd', 'ef', 'ab'), ('ef', 'ab', 'cd'), ('ef', 'cd', 'ab')]
I understand (I think) that due to needing mixed types, we need tuples instead of strings, but is there any way to work around this to get the strings?
Thanks much in advance?