Ant a écrit :
> On Aug 8, 11:10 am, Bruno Desthuilliers <bruno.
> [EMAIL PROTECTED]> wrote:
>> Jay Loden a écrit :
>> (snip)
>>
>>> If we just want to iterate through the file one line at a time, why not 
>>> just:
>>> count = 0
>>> handle = open('hugelogfile.txt')
>>> for line in handle.xreadlines():
>>>     count = count + 1
>>>     if count == '1000000000':
>>>         #do something
>> for count, line in enumerate(handle):
>>      if count == '1000000000':
>>          #do something
> 
> You'd get better results if the test were:
> 
> if count == 1000000000:
> 
> Or probably even:
> 
> if count == 999999999:
> 
> Since the 1 billionth line will have index 999999999.
> 

Doh :(

Thanks for the correction.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to