Re: [Tutor] keeping track of the present line in a file

2010-01-21 Thread Kent Johnson
On Thu, Jan 21, 2010 at 1:57 AM, sudhir prasad wrote: > hi, > is there any other way to keep track of line number in a file other than > fileinput.filelineno() With enumerate(): for line_number, line in enumerate(open('myfile.txt')): # etc Kent ___

Re: [Tutor] keeping track of the present line in a file

2010-01-21 Thread Alan Gauld
"sudhir prasad" wrote is there any other way to keep track of line number in a file other than fileinput.filelineno() You could always do it manually by incrementing a counter every time you read a line. But what's the problem with filelineno()? If you tell us what your problem is we mig

[Tutor] keeping track of the present line in a file

2010-01-20 Thread sudhir prasad
hi, is there any other way to keep track of line number in a file other than fileinput.filelineno() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor