python 基础 8.2 编译正则对象

#/usr/bin/python
#coding=utf-8
#@Time   :2017/11/14 9:55
#@Auther :liuzhenchuan
#@File   :编译正则对象.py
 
# 正则匹配时,优先编译成正则对象,然后进行匹配,这样程序的效率要高
import re
 
reg = re.compile(r'abc.*')
print type(reg)
print reg
 
 
 
>>>
<type '_sre.SRE_Pattern'>
<_sre.SRE_Pattern object at 0x0322B0B8>
posted @ 2017-11-16 00:34  刘振川的博客  阅读(147)  评论(0编辑  收藏  举报