python一次去掉所有标点符号

# python 去除字符串的标点符号
punctuation = '!,;:?"\'、,;'
def removePunctuation(text):
    text = re.sub(r'[{}]+'.format(punctuation),' ',text)
    return text.strip()

 

posted @ 2020-05-12 14:56  BruceLong  阅读(13789)  评论(0编辑  收藏  举报