So I am making a word generator that takes several inputted letters, puts them in all possible positions, and matches them with a document to find words. If I am approaching this wrong please tell me! If not how can I do this? Thanks
to generate all permutations of a given list of letters, use the itertools module.
import itertools
for word in itertools.permutations( list_of_letters ):
print ''.join(word)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With