计算字符出现次数并排序
#打开并读取文件file=open(r'C:\Users\cx\Desktop\Walden.txt','r')lines=file.readlines()lines#要把每行拆成单词words=[]for line in lines: tmp_list=line.split(" ")#print((line.split(" "))) for word in tmp_list: words.append(word)#words.a