from collections import Counter import re filename='中国姓名.txt' words=re.findall('w+',open(filename).read().lower()) str=Counter(words).most_common(100) print(str)