python 正则之提取字符串中的汉字

#过滤字符串中的英文与符号,保留汉字
import re
st = "hello,world!!%[545]你好234世界。。。"
ste = re.sub("[A-Za-z0-9\!\%\[\]\,\。]", "", str)
print(ste)
'你好世界'

猜你喜欢

转载自blog.csdn.net/luoganttcc/article/details/80946194