Python 正则表达式取值

import re

class Retest:
def __init__(self,string,path):
self.string = string
self.path = path

def retest(self):
res = re.search(self.string,self.path,flags=0).group()
# res.group()
print res
return

if __name__ == '__main__':
a = 'helloworld'
b = 'he(.+)ld'
  c = Retest(b,a)
  c.retest()
posted @ 2018-09-27 17:30  菜菜_包包  阅读(950)  评论(0编辑  收藏  举报