File to dict

Jeremy C B Nicoll jeremy at omba.demon.co.uk
Sat Dec 8 19:07:40 EST 2007


Chris <cwitts at gmail.com> wrote:

> For the first one you are parsing the entire file everytime you want
> to lookup just one domain...

Is the file sorted?  If so wouldn't it be easier either to read the whole
thing and then binary-chop search it, or if the file is vast to use seek
creatively to binary chop it but only read particular records from disk?

(One could chop by using seek to locate to a particular byte location in the
file then read to end of that record then read the next complete record.)

If the file isn't sorted, then .... why not?  Also if the file is vast
surely there's some or a lot of point in breaking it up into a group of
smaller files? 

-- 
Jeremy C B Nicoll - my opinions are my own.



More information about the Python-list mailing list