码迷,mamicode.com
首页 > 编程语言 > 详细

Python 的re模块

时间:2015-09-10 14:24:04      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

Python的正则表达式模块

1 # -*- coding:utf-8 -*-
2 
3 import re
4 text = "JGood is a handsome boy, he is cool, clever, and so on..."
5 m = re.match(r"(\w+)\s", text)
6 if m:
7     print m.group(0), \n, m.group(1)
8 else:
9     print not match  

 

Python 的re模块

标签:

原文地址:http://www.cnblogs.com/IDomyself/p/4797726.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!