[SciPy-user] convert shelved object back to dictionary

Travis Oliphant oliphant at ee.byu.edu
Thu Oct 6 11:06:41 CDT 2005


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