我是通过一个snippet解决的,如下:
# -*- mode: snippet -*-
# name: insert tensorflow code in orgmode
# key: tfs
# --
#+BEGIN_SRC python :session :python ~/.conda/envs/tensorflow/bin/python :exports both :results output
$1
#+END_SRC
如果想输出文件
# -*- mode: snippet -*-
# name: python src block with python with file result
# key: !pf
# --
#+BEGIN_SRC python :python ~/.conda/envs/tensorflow/bin/python :exports both :results file :var fname="${1:`(sangjee/buffer-basename)`}/${2:imagename}.png"
${3:import numpy as np
import matplotlib.pyplot as plt}
${4:#start your code}
plt.savefig(fname)
return fname
#+END_SRC
使用snippet之后,本人没有换行问题了。