readlines with line number support?
Arnaud Delobelle
arnodel at googlemail.com
Wed May 14 15:20:44 EDT 2008
Nikhil <mnikhil at gmail.com> writes:
> Arnaud Delobelle wrote:
>
>> The standard Python way is using enumerate()
>>
>> for i, line in enumerate(fp):
>> print "line number: " + lineno + ": " + line.rstrip()
>>
>
> I guess you meant to say :
>
> for lineno, line in enumerate(fp):
> print "line number: " + lineno + ": " + line.rstrip()
Yes!
--
Arnaud
More information about the Python-list
mailing list