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
___
"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
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