En Tue, 13 Oct 2009 10:21:31 -0300, <bbarb...@inescporto.pt> escribió:

I am using linecache.getline, to access to a line in a long file. It s really fast, appx 4seconds, but I was just wandering if any of you, know either another way, or there is something that I can do to speed it up... thank you very much for your help!!

If all the lines in the file have exactly the same length, you may seek to the specific line and read it at once. Otherwise I'm afraid you have to read all the previous n-1 lines to get to line n, and that's what makes it slow.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to