I have a string "dog"
and I wan't to generate all possible combinations with letters from that word.
Output would be something like this:
["dog","dgo","ogd","odg","god","gdo"]
Order does not matter at all.
I have a string "dog"
and I wan't to generate all possible combinations with letters from that word.
Output would be something like this:
["dog","dgo","ogd","odg","god","gdo"]
Order does not matter at all.
import itertools
word = 'dog'
result = [''.join(new_word) for new_word in itertools.permutations(word)]
print(result)