%store: Lightweight persistence for python variables.
%store allows you to save a variable and access it after exiting a session. To save a variable, you simply pass it as the sole argument:
In : my_name = 'Eric' In : %store my_name Stored 'my_name' (str)
You can then exit the session, enter a new one, and recall it with the
In : exit
In : my_name Out: NameError: name 'my_name' is not defined In : %store -r In : my_name Out: 'Eric'
You can edit your IPython configuration to always autoload any stored variables.
Show a list of all variables and their current values:
Store the current value of the variables
%store eggs motorcycles
Remove the variable
eggs and its value from storage:
%store -d eggs
Remove all variables from storage:
It should be noted that if you change the value of a variable, you need to
%storeit again if you want to persist the new value.