Python语言剔除除中英文及数字外的其他任何字符,可以通过正则表达式模块re把非中英文及数字的所有字符串删除,参考实现程序如下:
import re
# 通过re过滤除中英文及数字以外的其他字符
def filter_string(des_string, re_string=''):
res = re.compile("[^\\u4e00-\\u9fa5^a-z^A-Z^0-9]")
return res.sub(re_string, des_string)
参考资料
【1】https://zhuanlan.zhihu.com/p/144216817