Python code:
f = open("/home/pi/Desktop/file",'r')
words_dict={}
for i in f.read().split():
word=i.lower()
words_dict[word]= words_dict.get(word,0) + 1
for key in words_dict.keys():
print (str(key)+' = '+str(words_dict[key]))
file:
a23
233
6
544
4
2
4
7
9
0
No comments:
Post a Comment