[EMAIL PROTECTED] escreveu: > 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 > for n,l in enumerate(file("file")): print n,l[:-1] # the :-1 is to drop the \n - print n,l, also works (end with ','). HTH Paulo
-- http://mail.python.org/mailman/listinfo/python-list