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
NB : files now (well... since 2.3) handle iteration directly
http://www.python.org/doc/2.3/whatsnew/node17.html
--
http://mail.python.org/mailman/listinfo/python-list
