I was wondering how I can print all the text between a \begin statement and a \end statement. This is my code now. Also, how can I keep from printing certain words located between these 2 statements?
content=open("file", "r")
print content
content.read()
while len(content.split(start,1)) > 1:
start=("\begin")
end=("\end")
s=content
print find_between( s, "\begin", "\end" )
def find_between( s, first, last ):
try:
start = s.index( first ) + len( first )
end = s.index( last, start )
return s[start:end]
except ValueError:
return ""
print find_between( s, "\begin", "\end" )