标签:form img nts list mic coding tin ima 图片
import jieba txt = open("huozhe.txt", "r", encoding="utf-8").read() words = jieba.lcut(txt) counts = {} for word in words: if len(word) == 1: continue else: rword = word counts[rword] = counts.get(rword,0) + 1 items = list(counts.items()) items.sort(key=lambda x:x[1], reverse=True) for i in range(10): word, count = items[i] print("{0:<10}{1:>5}".format(word, count))
标签:form img nts list mic coding tin ima 图片
原文地址:https://www.cnblogs.com/wangyingjie123/p/12656289.html