用python实现对文档进行不同字符个数统计
问题引入:问题解决:1.用re模块import red = {}with open("E:\sample.txt", encoding = "utf-8") as f: for line in f: tmp = line.lower().strip() # 对一行字符串进行小写转换并切割两头空白符 lst = re.split('[ .(),=:"»~>*]', tmp) for s in lst: # if
原创
2021-03-31 21:19:56 ·
1412 阅读 ·
2 评论