[EMAIL PROTECTED] writes: > for n,l in enumerate(open("file")): > print n,l # this prints current line > print next line in this current iteration of the loop. > hope you can understand now.
I see. It just seemed a little weird. If the file contains first line second line third line You want the output: 1 first line second line 2 second line third line 3 third line Is that right? Anyway all the ways I can think of to do it are at least somewhat messy. Skip suggested one. It's easier if you're sure the file is small enough to fit all its lines completely into memory. -- http://mail.python.org/mailman/listinfo/python-list