在不同的 jupyter notebooks 之间共享变量 [英] Share variables between different jupyter notebooks

查看:70
本文介绍了在不同的 jupyter notebooks 之间共享变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的 Jupyter 笔记本,运行在同一台服务器上.我想要做的是通过另一个笔记本访问一个笔记本的一些(只有几个)变量(我必须比较两个不同版本的算法是否给出相同的结果,基本上).有没有办法做到这一点?

I have two different Jupyter notebooks, running on the same server. What I would like to do is to access some (only a few of them) of the variables of one notebook through the other notebook (I have to compare if the two different versions of the algorithm give the same results, basically). Is there a way to do this?

谢谢

推荐答案

在2个jupyter notebook之间,可以使用%store命令.

Between 2 jupyter notebook, you can use the %store command.

在第一个 jupyter notebook 中:

In the first jupyter notebook:

data = 'string or data-table to pass'
%store data
del data

在第二个 jupyter 笔记本中:

In the second jupyter notebook:

%store -r data
data

您可以在此处找到更多信息.

You can find more information at here.

这篇关于在不同的 jupyter notebooks 之间共享变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆