直接上代码
import re
def removePunctuation(self, content):
"""
文本去标点
"""
punctuation = r"~!@#$%^&*()_+`{}|\[\]\:\";\-\\\='<>?,./,。、《》?;:‘“{【】}|、!@#¥%……&*()——+=-"
content = re.sub(r'[{}]+'.format(punctuation), '', content)
return content.strip().lower()