Created
April 13, 2010 03:18
-
-
Save tkaemming/364275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
def find_anagrams(input_word): | |
words = (word[:-1] for word in open('/usr/share/dict/words').readlines()) | |
return [word for word in words if (sorted(word) == sorted(input_word) and word != input_word)] | |
if __name__ == '__main__': | |
import sys | |
print find_anagrams(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment