简体   繁体   中英

iPython notebook: store interactive output preview

I really like the interactive functionality of the new iPython notebook.

I often use it to replace plots, and make them more informative.

The problem is, that the output of these interactive cells is not stored in the notebook (for offline viewing).

When I shutdown and reopen the notebook, there is no preview for these cells (while there is for non-interactive cells). The same happens when previewing on github.

Is there a way to dó store the (static) output of interactive cells? I understand that the interactive cell will have to be run in order to be interactive, but I would like to store a snapshot of the cell. The exact parameters that are being used to execute the function do not matter too much for me (though it would be nice to be able to set them).

Example: running an interactive notebook: 笔记本运行

Example: after closing and reopening: 重新打开笔记本

I am using:

  • python 3.6.1
  • iPython 4.6.1

Renew : Sorry for my bad comprehension, and what you want must be the following codes: 代表装饰者

def represent(**default_args):
    def _wrapper_func(func):
        print("See some examples here!")
        print(f"[Example] Default arguments :{default_args}")
        print(f">> {func.__name__}(**{default_args})")
        print(f">> {func(**default_args)}")
        def _setargs(*args, **kwargs):
            return func(*args, **kwargs)
        return _setargs
    return _wrapper_func

------------------------------The old answer-------------------------------

It seems that you just need some snapshot to show how you dealt with the codes before. The solution is easy, see the following picture I give out. 指南

Save it in some specific place and review it if you need, while you have forget the meanings of you once codes!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM