import re
a = """This is the first line, in English, which must be deleted.
这是第二行,中文内容,但是也会有几个English words。需要保留。
This is the third line, in English, which must be deleted.★★★"""
r = re.compile('^[\x00-\x7F]+(\xA1\xEF)*\s{0,1}$', re.M|re.U)
print r.sub('', a)
用python写的一个正则表达式的程序。有点意思
阅读(1201) | 评论(0) | 转发(0) |