... and decide execution of that block based on the presence of that word?
For example I have this:
for frame in range(10):
with open('frame_init.gro', 'w') as g:
# do something
with open('frame_next.gro', 'w') as h:
# do something
When "frame" reaches 9, I don't want the whole with open('frame_next.gro', 'w') as h
block to execute at all. Of course I have considered just encasing it in a if frame != 9
but my actual entire code is really long so it would be nice if I could just scan my script within the script itself if it is possible.
For those curious about what other things frame_next.gro
is involved in, the answer is lots of calculations