作业要求参见 https://edu.cnblogs.com/campus/nenu/2018fall/homework/2126
file_name=‘C://wf_python//gongneng1.txt‘ total=0
open函数打开gongneng1的文本,对读取的文本文档逐行进行遍历,将文本逐行存在line中
重点:通过split()函数将单词与符号分隔开,计算每个词的个数
file=open(file_name,"r")
for line in file.readlines():
w = line.split(‘ ‘)
total=total + len(w)
print ("total ",total)
print(‘\n‘)
重点:通过python自带模块的counter函数对总单词数进行统计。
counter = collections.Counter(patt.findall(
open(file_name,‘rt‘).read()
))


差异原因:对自己编程能力高估,本科很多知识点都没有学到,花了大量的时间进行查阅资料,还是无法实现这些功能,以后会继续加强努力的,
| 阶段 | 估计时间(单位:分钟) | 实际时间(单位:分钟) | 差异时间(单位:分钟) |
| 功能1 | 303 | 603 | +300 |
| 功能2 | 215 | 248 | +33 |
| 功能3 | -- | -- | -- |
| 功能4 | -- | -- | -- |
| 测试功能 | 100 | 94 | -6 |
| 词频统计项目 | 618 | 945 | 327 |
原文:https://www.cnblogs.com/zy1122/p/9696040.html