future2012lg

博客园 首页 新随笔 联系 订阅 管理

2013年5月18日 #

摘要: re.match re.match 尝试从字符串的开始匹配一个模式,如:下面的例子匹配第一个单词。 import re text = "JGood is a handsome boy, he is cool, clever, and so on..." m = re.match(r"(\w+)\s", text) if m: print m.group(0), '\n', m.group(1) else: print 'not match' import re text = "JGood is a handsom 阅读全文
posted @ 2013-05-18 21:41 future2012lg 阅读(272) 评论(0) 推荐(0) 编辑