-
方法3: 使用
org-mode
:#+BEGIN_SRC python :results output import test1 test1.test() #+END_SRC #+RESULTS: : test2
在
BEGIN_..END_
之间按 C-c C-c 执行代码,自动加载test1.py
。如果你只是做些实验,这种方式更好。如果你只是想共享一些代码片段,连 module 都没有必要使用,可以参考之前的讨论: https://emacs-china.org/t/org-mode-ipython-src-block/2476/3。
1 个赞