I am trying to read sections of a file into numpy arrays that have similar start and stop flags for the different sections of the file. At the moment I have found a method
You have indentation problem, your code should look like this:
with open("myFile.txt") as f:
array = []
parsing = False
for line in f:
if line.startswith('stop flag'):
parsing = False
if parsing:
#do things to the data
if line.startswith('start flag'):
parsing = True