>>> with open("E:/cipin.txt") as wf,open("E:/asd.txt",'w') as wf2:
... for word in wf:
... word_lst.append(word.split(','))
... for item in word_lst:
... for item2 in item:
... if item2 not in word_dict:
... word_dict[item2] = 1
... else:
... word_dict[item2] += 1
... for key in word_dict:
... print(key,word_dict[key])
... wf2.write(key+' '+str(word_dict[key])+'\n')
...
9
4
[行政]关于2018年第二批教师招聘工作安排的通知 3.9
8
33
[行政]计划财务部关于调整具备正高级职称人员使用科研经… 3.9
7
... for word in wf:
... word_lst.append(word.split(','))
... for item in word_lst:
... for item2 in item:
... if item2 not in word_dict:
... word_dict[item2] = 1
... else:
... word_dict[item2] += 1
... for key in word_dict:
... print(key,word_dict[key])
... wf2.write(key+' '+str(word_dict[key])+'\n')
...
9
4
[行政]关于2018年第二批教师招聘工作安排的通知 3.9
8
33
[行政]计划财务部关于调整具备正高级职称人员使用科研经… 3.9
7
36
----------------------------------------------