Created
December 9, 2011 13:46
-
-
Save j605/1451590 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/python2.7 | |
stream = open("words.txt",'r') | |
def get_words(): | |
words = [] | |
for word in stream: | |
words.append(word.strip()) | |
return words | |
def get_unique_elements_list(l): | |
l = dict.fromkeys(l) | |
l = l.keys() | |
return l | |
def mapper(): | |
mapped = {} | |
wordlist = get_words() | |
for word in wordlist: | |
t = tuple(word) | |
w = [] | |
for word1 in wordlist: | |
if sorted(t) == sorted(tuple(word1)): | |
w.append(word1) | |
mapped[t] = w | |
print mapped | |
mapper() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment