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