building an index for large text files for fast access
alex23
wuwei23 at gmail.com
Tue Jul 25 02:44:54 EDT 2006
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
> for fast access. Can anybody give me some tips on how to do this in
> Python? Thanks.
Hey Yi,
The standard library module 'libcache' does exactly what you're
considering implementing.
-alex23
More information about the Python-list
mailing list