Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- words_set=set([])
- for line in open('word.list', 'r'):
- words_set.add(line.strip())
- import sys
- letters = list(sys.argv[1])
- n = int(sys.argv[2])
- import itertools
- found=[]
- for x in itertools.permutations(letters, n):
- w = ''.join(x)
- if w in words_set and not w in found:
- print 'found', w
- found.append(w)
Add Comment
Please, Sign In to add comment