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()
原文地址:https://www.cnblogs.com/jinbaobao/p/9714450.html