python实现一个函数能够计算一段文本中每个单词出现的次数。

#!/usr/bin/env python

#_coding:utf-8 _

#filename : countword.py

import re
import os

count = 0
word=raw_input(“What’s word dou you want to find:”)
f= open(‘aaa.txt’)
for file in f.readlines():
if word in file:
count +=1
print count