Skip to content

Instantly share code, notes, and snippets.

@j605
Created December 9, 2011 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j605/1451590 to your computer and use it in GitHub Desktop.
Save j605/1451590 to your computer and use it in GitHub Desktop.
#! /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