Created
April 13, 2015 23:36
-
-
Save mikestratton/9289aa9ca65e5a6e5435 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/python | |
import re | |
file=open("HAWAII_GOV_readout_ANSI.txt","r+") | |
wordcount={} | |
for word in file.read().split(): | |
#remove alphanumeric characters and underscores | |
word = re.sub('[^\w]', '', word) | |
if word not in wordcount: | |
wordcount[word] = 1 | |
else: | |
wordcount[word] += 1 | |
for k,v in wordcount.items(): | |
print(k,v) | |
#print(word,wordcount) | |
file.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment