I have a text file which looks like:
line A
line B
line C
line D
objective
8.5770822e+000
3762931e+000
0996787e+000
0070925e+000
0003053e+000
9999994e+000
line E
line F
line G
I want to import numbers under the word "objective" into a Python list.
Challenges: The number of lines (with numbers) under the line with "objective" need not be the same. It varies from file to file. I am trying to develop a generic code. So the stop condition must be based on a blank line under the numbers.
My idea:
I was able to access the line "objective" with the code if line.startswith("objective")
But to access the lines below until you find a blank line seems challenging.
Can you please help me with this?
Thank you very much.