building an index for large text files for fast access

Yi Xing yxing at stanford.edu
Tue Jul 25 02:05:46 EDT 2006


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. Can anybody give me some tips on how to do this in 
Python? Thanks.

Yi 




More information about the Python-list mailing list