[EMAIL PROTECTED] wrote:
> say i want to enumerate lines of a file
> eg
> for n,l in enumerate(open("file")):
> # print next line ie
I think you'd find it much easier to move your frame of reference one
line forward and think in terms of remembering the previous line, e.g.:
for n,curr in enumerate(open("file")):
if n>1:
print n,curr
print m,prev
m,prev = n,curr
Of course, if the file isn't so big, then you could use readlines as you
mention.
Cheers,
Terry
--
Terry Hancock ([EMAIL PROTECTED])
Anansi Spaceworks http://www.AnansiSpaceworks.com
--
http://mail.python.org/mailman/listinfo/python-list