#use python3.6
import re
from collections import Counter
FILESOURCE = './abc.txt'
def getMostCommonWord(artlclefilesource):
pattern = r"""[A-Za-z]+|\$?\d+%?$"""
with open(artlclefilesource) as f:
r = re.findall(pattern,f.read())
return Counter(r).most_common()
if __name__ == "__main__":
print(getMostCommonWord(FILESOURCE))
转载于:https://www.cnblogs.com/Mysterious/p/7479752.html