I'm trying to find a way to take a list of one-letter strings, for example,

and find every order possible of these letters.
I'll be able to, on my own, target the three words I would want for this, 'noter', 'toner', and 'tenor' (unless the dictionary file I have has other words), but the actual process of finding all these combinations eludes me.
I found an inquiry on all permutations of a certain length, which in thise list would also also include stuff like 'nntot' or 'reter',
I found a function that does something vaguely like what I think I want, but in testing has been more confusing than helpful,
and I found five sites that in my many searches ended up not actually having anything to do with what I was trying to do.
... Researching is confusing. Help?

Try this

from itertools import permutations
for t in permutations(['e', 'n', 'o', 't', 'r']):
    print t

;)

Try this

from itertools import permutations
for t in permutations(['e', 'n', 'o', 't', 'r']):
    print t

;)

Ah. So the one that looked like what I thought but was more confusing than helpful was the one I want.
... now, is there a way to take that same set with the same function and have it be able to come up with 'tenor' 'toner' 'noter' 'note' 'tone' 'ten' 'ton' 'not' 'net' 'rot' 'nor' etc.? Basically all permutations of at least three letters? For now, though, I'll implement that in. Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.