I've an ASCII file written as:
FLAG: YES
TIME: 2016/04/06 12:07:51.249999 YELLOW
TYPE: FLEX
FLAG: NO
TIME: 2016/04/06 12:51:17.455175 YELLOW
TYPE: FLEX
FLAG: YES
TIME: 2016/04/06 13:49:04.999987 BLUE
TYPE: NON-FLEX
FLAG: YES
TIME: 2016/04/06 15:59:25.255675 GREEN
TYPE: BETA
and so on. As you can see, the file is structured in blocks of three lines each (FLAG, TIME, TYPE). I'd like to read this file and, depending on the entry 'FLAG', I want to store the related time variables and work on them etc.
I need to do this in python, but I can't read the file line-by-line, given the presence of blocks. I'm not sure about what could be the most efficient way to do that (I'm used to C++, not very skilled in python).
file.openetc., but I guess here one should read a file depending on the line number or something like that...