an enumerate question

eight02645999 at yahoo.com eight02645999 at yahoo.com
Mon Mar 19 21:38:50 EDT 2007


hi
say i want to enumerate lines of a file
eg
for n,l in enumerate(open("file")):
     # print  next line ie

is there a way to print out the next line from current line using the
above?.
Or do i have to do a readlines() first to get it into a list eg
d = open("file").readlines()
for n, l in enumerate(d):
    print d[n+1]

thanks




More information about the Python-list mailing list