I have a text file and I want to extract a block of text from the starting point till the ending point. The text file looks like below:
01.08.2016 00:00:00 ==================UK==========================
01.08.2016 09:15:34 Market : UK
01.08.2016 09:15:34 From : 01/07/2016
01.08.2016 09:15:34 To : 31/07/2016
01.08.2016 09:15:39 ==================GERMANY==========================
My starting point is ==================UK==========================
and ending point is ==================GERMANY==========================
Below is the code I have written but it does not seem to work.
import re
START = '==================UK=========================='
END = '==================GERMANY=========================='
fd = open('export_xml.log', 'r').read()
result = re.search('%s(.*)%s' % (START,END), fd)
print result