I’m working inside the Python REPL, and I want to save my work periodically. Does anybody have a script to dump all the variables I have defined? I’m looking for something like this:
for o in dir():
f=open(o)
pickle(o_as_object, f)
This seems like something other people have done, so I wanted to ask before re-inventing the wheel.
I think you want Dill:
Note that it’s still in alpha, so don’t rely on it to store critical data.
Of course, some things can’t be restored, such as an open file handle. But you can get quite close.