very large dictionary

Jorgen Grahn grahn+nntp at snipabacken.se
Sun Aug 3 16:36:33 EDT 2008


On Fri, 1 Aug 2008 01:05:07 -0700 (PDT), Simon Strobl <Simon.Strobl at gmail.com> wrote:
>> What does "load a dictionary" mean?
>
> I had a file bigrams.py with a content like below:
>
> bigrams = {
> ", djy" : 75 ,
> ", djz" : 57 ,
> ", djzoom" : 165 ,
> ", dk" : 28893 ,
> ", dk.au" : 854 ,
> ", dk.b." : 3668 ,
> ...
>
> }
>
> In another file I said:
>
> from bigrams import bigrams
>
>> How about using a database instead of a dictionary?
>
> If there is no other way to do it, I will have to learn how to use
> databases in Python.

If you use Berkeley DB ("import bsddb"), you don't have to learn much.
These databases look very much like dictionaries string:string, only
they are disk-backed.

(I assume here that Berkeley DB supports 7GB data sets.)

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.se>          R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list