[Tutor] need advice about a dictionary ({})

Richard D. Moores rdmoores at gmail.com
Sun Sep 11 03:32:15 CEST 2011

On Sat, Sep 10, 2011 at 17:34, Alan Gauld <alan.gauld at btinternet.com> wrote:
> On 11/09/11 00:18, Richard D. Moores wrote:
>>> So you open the file and from that point on treat it exactly like a
>>> dictionary.
>> I'm still a bit shaky about dictionaries.
> But you started the post with using a dictionary.
> Shelve is just a dictionary that lives in a file instead of memory.
> If you can put data into or read it out of a dictionary then you can do the
> same with shelve.
> The only complexity is you have to open the file before sing it and close it
> when your done.
>> Much of what comes after that is beyond me.
>> Thanks for your encouragement Alan, but I'm still looking among my
>> Python books for a good exposition of shelve.
> You probably won't find much in books because shelve has such a specific
> purpose. As a result there isn't much to say about it
> if you've already covered dictionaries.
> It's a file based dictionary. So read up on dictionaries.
> Then just use it.
> There are a few limitations with shelve but for most normal
> cases you can ignore that and just use it like any normal
> dictionary.

OK, Alan, I really will give shelve a try.


More information about the Tutor mailing list