Skip to content

Instantly share code, notes, and snippets.

@pyro2927
Created November 11, 2014 00:24
Show Gist options
  • Save pyro2927/98c280fd827bf8fcc05b to your computer and use it in GitHub Desktop.
Save pyro2927/98c280fd827bf8fcc05b to your computer and use it in GitHub Desktop.
import string
def scaryDict(filename):
inFile = open(filename)
outFile = open('dictonary.txt', 'w') #find universal solution
content = inFile.read()
content = ''.join([c for c in content.lower() if c in (string.letters + string.whitespace) ])
words = sorted(set(content.split()))
for word in words:
if len(word) <= 2:
words.remove(word)
print(words[:40])
scaryDict('frankenstein.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment