I look through the file and, if I find something, I would like to read a few lines that are looking for something before returning control to the main loop. However, I want to regain control at the moment when I stopped looking into the future.
Code example:
for line in file: line = line.strip() llist = line.split() if llist[0] == 'NUMS':
Input Example:
NUMS 1 2 3 4 5 END SOME MORE STUFF NUMS 6 7 8 9 0 END
Required Conclusion:
1 2 3 4 5 6 7 8 9 0
I am new to Python, so if there is a better way to do this, besides using a loop to look forward, I'm glad to see it.
source share