首页
科技
登录
6mi
u
盘
搜
搜 索
科技
python正则表达式过滤非中英文和数字的字符串
python正则表达式过滤非中英文和数字的字符串
it
2022-05-05
161
import
re sentence
=
"厉害了我的村!40亩地种了这些“植苗”,当年结果,村民富裕了"
# 方法一
re
.
sub
(
'[^\w\u4e00-\u9fff]+'
,
''
,
sentence
)
# 方法二
re
.
sub
(
'[^\u4e00-\u9fa5^a-z^A-Z^0-9]'
,
''
,
sentence
)
转载请注明原文地址: https://win8.8miu.com/read-10183.html
专利
最新回复
(
0
)