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>
原文地址:https://www.cnblogs.com/lzcys8868/p/7842049.html