Yi Xing wrote:
> Hi,
>
> I need to read specific lines of huge text files. Each time, I know
> exactly which line(s) I want to read. readlines() or readline() in a
> loop is just too slow. Since different lines have different size, I
> cannot use seek(). So I am thinking of building an index for th
Erik Max Francis wrote:
> I believe the module you're referring to is `linecache`.
Thanks, Erik. That's what I get for posting on my way out of work :)
-alex23
--
http://mail.python.org/mailman/listinfo/python-list
Erik Max Francis wrote:
> alex23 wrote:
>
> > The standard library module 'libcache' does exactly what you're
> > considering implementing.
>
> I believe the module you're referring to is `linecache`.
>
and whatever its name is, it's not a goer: it reads the whole of each
file into memory. It was
alex23 wrote:
> The standard library module 'libcache' does exactly what you're
> considering implementing.
I believe the module you're referring to is `linecache`.
--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfran
Yi Xing:
> Since different lines have different size, I
> cannot use seek(). So I am thinking of building an index for the file
> for fast access. Can anybody give me some tips on how to do this in
> Python?
It depends on the size of the files and the amount of memory and
disk you may use
Yi Xing wrote:
> I need to read specific lines of huge text files. Each time, I know
> exactly which line(s) I want to read. readlines() or readline() in a
> loop is just too slow. Since different lines have different size, I
> cannot use seek(). So I am thinking of building an index for the file
>
Hi,
I need to read specific lines of huge text files. Each time, I know
exactly which line(s) I want to read. readlines() or readline() in a
loop is just too slow. Since different lines have different size, I
cannot use seek(). So I am thinking of building an index for the file
for fast access