On 3/18/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, Daniel Nogradi
> wrote:
>
> >> f = open('file.txt','r')
> >> for line in f:
> >>         db[line.split(' ')[0]] = line.split(' ')[-1]
> >>         db.sync()
> >
> > What is db here? Looks like a dictionary but that doesn't have a sync 
> > method.
>
> Shelves (`shelve` module) have this API.  And syncing forces the changes
> to be written to disks, so all caching and buffering of the operating
> system is prevented.  So this may slow down the program considerably.

It is a handle for bsddb

import bsddb
db=bsddb.hashopen('db_filename')
Syncing will defenitely slow down. I will slow that down. But is there
any improvement I can do to the other part the splitting and setting
the key value/pair?
thanks
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to