I am a newcomer to python, and am not really much more than a hack at
the other languages I speak, so forgive me if this is an easy
question.
I am processing a text file, taking an action based on what I find in
each line. Independently of what the file contains, I need to take
another action every 100 lines. Currently I am using something to the
effect of:
i = 0
for line in file:
if i == 100:
action
i = 0
else:
i += 1
process(line)
But this doesn't feel like a very python-esque solution to me, and is
not very elegant in any case. What would be a better way to do it?
Thanks.