Re: building an index for large text files for fast access

2006-07-25 Thread Simon Forman
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

Re: building an index for large text files for fast access

2006-07-25 Thread alex23
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

Re: building an index for large text files for fast access

2006-07-25 Thread John Machin
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

Re: building an index for large text files for fast access

2006-07-24 Thread Erik Max Francis
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

Re: building an index for large text files for fast access

2006-07-24 Thread Neil Hodgson
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

Re: building an index for large text files for fast access

2006-07-24 Thread alex23
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 >

building an index for large text files for fast access

2006-07-24 Thread Yi Xing
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