Created
November 11, 2014 00:24
-
-
Save pyro2927/98c280fd827bf8fcc05b 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
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