Chinaunix首页 | 论坛 | 博客
  • 博客访问: 414788
  • 博文数量: 116
  • 博客积分: 7087
  • 博客等级: 少将
  • 技术积分: 1175
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-19 23:32
文章分类

全部博文(116)

文章存档

2012年(1)

2011年(2)

2010年(10)

2009年(21)

2008年(18)

2007年(12)

2006年(21)

2005年(31)

我的朋友

分类: Python/Ruby

2007-02-06 17:05:20

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写的一个正则表达式的程序。有点意思
阅读(1167) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~