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
Let's say this is your file to read:
**starting**
blabla
blabla
**starting**
bleble
bleble
**starting**
bumbum
bumbum
This is code of the program:
file = open("testfile.txt", "r")
data = file.read()
file.close
data = data.split("**starting**")
print(data)
And this is output:
['', '\nblabla\nblabla\n', '\nbleble\nbleble\n', '\nbumbum\nbumbum']
Later you can del empty element, or do other operation in your data. split function is buildin for string objects and can get more complicated strings as arguments.