self.viewerData = []
tempViewerData = []
tempViewer = []
started = False
with open("tittardata.txt", "r") as fp:
for i, line in enumerate(fp.readlines()):
if line.startswith("=="):
started = True
continue
if started and line.startswith("--"):
started = False
if started == True:
tempViewerData.append(line.rstrip("\n"))
I am trying to read the blocks from the txt file below which are separated by "---" on both ends. On the first block the separation is handled by different symbols starting with "===" and ending with "--". The upcoming blocks are parsed by the same symbol, making it more difficult to extract the blocks. This is my attempt this far, all help is appreciated.
Here is an extract from the text file:
=================
19.37/2
19.52/2
21.07/1
21.22/1
21.37/1
-------
19.37/2
19.52/2
-------