擅长:python、mysql、java
<pre><code>File_Name = 'file.txt'
counterDict={}
with open(File_Name,'r') as fh:
for line in fh:
# removing their punctuation
words = line.replace('.','').replace('\'','').replace(',','').lower().split()
for word in words:
if word not in counterDict:
counterDict[word] = 1
else:
counterDict[word] = counterDict[word] + 1
print('Count of the word > common< :: ', counterDict.get('common',0))
</code></pre>