You can use regular expressions for that.
>>> st = "alpha here is my text bravo"
>>> import re
>>> re.findall(r'alpha(.*?)bravo',st)
[' here is my text ']
My test.txt file
alpha here is my line
yipee
bravo
Now using open to read the file and than applying regular expressions
.
>>> f = open('test.txt','r')
>>> data = f.read()
>>> x = re.findall(r'alpha(.*?)bravo',data,re.DOTALL)
>>> x
[' here is my line
yipee
']
>>> "".join(x).replace('
',' ')
' here is my line yipee '
>>>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…