Last active
August 29, 2015 14:09
-
-
Save oparin-alexander/5306ebf85308dde10f85 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
file_name = input() | |
fin = open(file_name, 'r') | |
text = fin.readlines() | |
dictionary = {} | |
for str in text: | |
for word in str.split(): | |
try: | |
dictionary[word] = dictionary[word] +1 | |
except KeyError: | |
dictionary[word] = 1 | |
print (dictionary) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment