Update task2.py

main
p6fxi93qh 2 months ago
parent b8c9cad23d
commit 9b0894c748

@ -29,8 +29,7 @@ def findfrecuency(txt_path,keywords,outpath):
elif keyword in line: elif keyword in line:
keyword_count[keyword] += 1 keyword_count[keyword] += 1
resultword.append(line) resultword.append(line)
resultword1 = list(set(resultword)) writeintxt(resultword,outpath)
writeintxt(resultword1,outpath) #去重
return keyword_count#返回字典 return keyword_count#返回字典
else: else:
print("文件不存在\n") print("文件不存在\n")

Loading…
Cancel
Save