首页 > 编程语言 > 详细

Python 使用正则表达式

时间:2017-07-29 09:48:25      阅读:242      评论:0      收藏:0      [点我收藏+]

当使用正则表达式时,re 模块内部会干两件事情

1、编译正则表达式,如其字串本身不合法,报错

2、用编译后的正则表达式去匹配字符串

 

re_telephone = re.compile(r‘^(\d{3})-{\d{3,8}}$‘)

re_telephone.match(‘010-12345‘).groups()

Python 使用正则表达式

原文:http://www.cnblogs.com/m2492565210/p/7253179.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!