[SciPy-user] convert shelved object back to dictionary

Ryan Krauss ryanfedora at comcast.net
Thu Oct 6 11:20:37 CDT 2005


Just about.  For some reason __dict__ didn't come up as an option when
I typed user. and hit tab in Ipython, so I didn't know it was there. 
The only slight problem with __dict__ is that it includes some
properties like __builtins__ that I would like to filter out of the
dictionary.

Thanks for your help.

Ryan

On 10/6/05, Travis Oliphant <oliphant at ee.byu.edu> wrote:
> Ryan Krauss wrote:
>
> >Is there an easy way to convert a shelved object back to a dictionary?
> > When I save a dictionary using scipy.io.sve and then load it in a
> >later session, I have an object whose property names are the keys of
> >the dictionary used as an input to shelve.  For example, instead of
> >user['name'] I have user.name.  I would prefer to have the scripts I
> >write to analyze the saved data have a similar syntax to the ones I
> >used to create it, so I would rather deal with a dictionary after I
> >load the shelved data.
> >
> >
>
> Does  user.__dict__  give you what you want?
>
> So
>
> user=user.__dict__  would allow you to do what you want to do?
>
>
> -Travis
>
>
>



More information about the SciPy-user mailing list