python正则表达式过滤非中英文和数字的字符串

it2022-05-05  161

import re sentence = "厉害了我的村!40亩地种了这些“植苗”,当年结果,村民富裕了" # 方法一 re.sub('[^\w\u4e00-\u9fff]+', '', sentence) # 方法二 re.sub('[^\u4e00-\u9fa5^a-z^A-Z^0-9]', '', sentence)

最新回复(0)