Python 正则 提取由start开始到end结束的行

import re

s=open(r"bug.txt").read()

regexpr=re.compile(r"start(.*?)end",re.DOTALL)

result=regexpr.search(s)

try:

    print result.group(1)

except:

    print "Can't find match string"

猜你喜欢

转载自scm002.iteye.com/blog/2264490
今日推荐