如何在多个单元格和多个笔记本中添加markdown代码段?
理想情况下,当我更改代码段时,它会在包含它的任何地方进行更新。
答案 0 :(得分:1)
Tukushan,
http://ipython.readthedocs.io/en/stable/config/extensions/storemagic.html
尝试%store
命令。我无法使用函数或markdown,因此我将markdown片段存储为文本,然后在新笔记本中使用%store -r <variable>
读取它。
示例:
在notebook_1中:
title_var = "# Re-Useable Title"
%store title_var
在notebook_2中存储'title_var'(str)
:
%store -r title_var