Try:
lines = iter(open('something.txt', 'r'))
for val in lines:
if val == "!":
lines.next()
continue
<etc>
You may want to catch StopIteration somewhere. It’ll occur if the iterator is finished.
Try:
lines = iter(open('something.txt', 'r'))
for val in lines:
if val == "!":
lines.next()
continue
<etc>
You may want to catch StopIteration somewhere. It’ll occur if the iterator is finished.