[Tutor] general basic question

Robert Berman bermanrl at cfl.rr.com
Wed Feb 8 22:08:07 CET 2012


On Wed, Feb 8, 2012 at 2:57 PM, ken brockman <krush1954 at yahoo.com> wrote:

>
>
> On Wed, Feb 8, 2012 at 12:33 PM, ken brockman <krush1954 at yahoo.com> wrote:
> >> Using pickling I have somehow managed to save two separate lists, but
> the
> >> dictionary is giving me much more of a struggle.
>
> Got it. I manage to get it to save to disk, but only by using the shell to
> create an empty dictionary then pickling it and saving it to a file.
> Priming the pump as it were. I had thought i had read that when you pickle
> and save a list or dictionary to file, if it didn't already exist, it would
> be created. That hasn't been my experience. Had I misunderstood or Am i
> doing something wrong? Just for future reference. I'm as happy as the
> proverbial pig in excrement just to get it to function.
> Thanks all for your help.
> Ken
>
> Ken,


Let me see if I understand your problem. You are pickling a dictionary and
finding that it will not work unless there already is an existing
dictionary for your pickled dictionary to write over. Otherwise, there is
either no write at all or the write is followed by a delete.  Is that a
reasonable definition of your current problem?

Robert Berman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120208/cb4764bc/attachment.html>


More information about the Tutor mailing list