#P147-See You Again 统计频次
import re
fp=open('../Stu_pack/See You Again.txt','r')
txt=fp.read()
fp.close()
txt=txt.lower()
txt=re.sub('[,.?:''\'!-]','',txt)
words=txt.split()
word_sq={}
for each in words:
if each not in word_sq.keys():
word_sq[each]=1
else:
word_sq[each]=word_sq[each]+1
print(word_sq)
res=sorted(word_sq.items(),key=lambda x:x[1],reverse=True)
print(res)