import collections
f=open("D:\python\Walden.txt","r").read()
f=f.replace(',','').replace('.','').replace('"','').replace(':','')
f=f.split()
r=collections.Counter(f)
print(r)
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-1-00bebec356b4> in <module>()
1 import collections
2 1
----> 3 f=open("D:\python\Walden.txt","r").read()
4 1
5 f=f.replace(',','').replace('.','').replace('"','').replace(':','')
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\python\\Walden.txt'