python read file between two strings

Solutions on MaxInterview for python read file between two strings by the best coders in the world

showing results for - "python read file between two strings"
Lia
23 Mar 2016
1inRecordingMode = False
2for line in file:
3    if not inRecordingMode:
4        if line.startswith('<START>'):
5            inRecordingMode = True
6    elif line.startswith('<END>'):
7        inRecordingMode = False
8    else:
9        yield line
10
similar questions
queries leading to this page
python read file between two strings