A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://ipython.readthedocs.io/en/latest/config/extensions/storemagic.html below:

Website Navigation


storemagic — IPython 9.5.0.dev documentation

Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

storemagic

%store magic for lightweight persistence.

Stores variables, aliases and macros in IPython’s database.

To automatically restore stored variables at startup, add this to your ipython_config.py file:

c.StoreMagics.autorestore = True
StoreMagics.store(parameter_s='')

Lightweight persistence for python variables.

Example:

In [1]: l = ['hello',10,'world']
In [2]: %store l
Stored 'l' (list)
In [3]: exit

(IPython session is closed and started again...)

ville@badger:~$ ipython
In [1]: l
NameError: name 'l' is not defined
In [2]: %store -r
In [3]: l
Out[3]: ['hello', 10, 'world']

Usage:

It should be noted that if you change the value of a variable, you need to %store it again if you want to persist the new value.

Note also that the variables will need to be pickleable; most basic python types can be safely %store’d.

Also aliases can be %store’d across sessions. To remove an alias from the storage, use the %unalias magic.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4