import re
with open("text.txt") as f:
#读取文件中的字符串
txt = f.read()
#去除字符串中的标点、数字等
txt = re.sub('[,\.()":;!@#$%^&*\d]|\'s|\'', ''
用python统计英文文章词频
最新推荐文章于 2023-09-10 21:40:49 发布
import re
with open("text.txt") as f:
#读取文件中的字符串
txt = f.read()
#去除字符串中的标点、数字等
txt = re.sub('[,\.()":;!@#$%^&*\d]|\'s|\'', ''