# coding: utf-8 import re text = "aa[bb,aa#cWc中a国" FILTER_PUNTS = re.compile("[^\u4E00-\u9FA5|^a-z|^A-Z]") text = FILTER_PUNTS.sub(" ", text.strip()) print(text)
ARTS-S python把非汉语和非字母的字符替换成空格
原文:https://www.cnblogs.com/zhouyang209117/p/11172957.html