Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redirect 将所有函数输出重定向到结果_Redirect_Emacs_Org Mode_Org Babel - Fatal编程技术网

Redirect 将所有函数输出重定向到结果

Redirect 将所有函数输出重定向到结果,redirect,emacs,org-mode,org-babel,Redirect,Emacs,Org Mode,Org Babel,在使用python源代码时 #+BEGIN_SRC python :session test :results output print('testing1') print('testing2') #+END_SRC #+RESULTS: : testing1 : testing2 将:结果设置为输出,然后获得2个结果 试试elisp #+begin_src emacs-lisp :results output (+ 21 35 12 7) (* 25 4 12) #+end_src #

在使用python源代码时

#+BEGIN_SRC python :session test :results output
print('testing1')
print('testing2')
#+END_SRC

#+RESULTS:
: testing1
: testing2
:结果设置为输出,然后获得2个结果

试试elisp

#+begin_src emacs-lisp  :results output
(+ 21 35 12 7)
(* 25 4 12)
#+end_src

#+RESULTS:

如何让elisp代码将输出重定向到结果?这些源代码块有不同的行为——当elisp只计算表达式时,python代码打印到stdout

可能需要一个等效的elisp块

#+BEGIN_SRC elisp :results output
(princ (+ 21 35 12 7))
(print (* 25 4 12))
#+END_SRC

#+RESULTS:
: 75
: 1200
如果要捕获这两个表达式的结果,可以将它们包装在列表中

#+BEGIN_SRC elisp :results value verbatim
(list (+ 1 1) (* 2 2))
#+END_SRC

#+RESULTS:
: (2 4)

#+BEGIN_SRC python :session test :results value verbatim
1 + 1, 2 + 2
#+END_SRC

#+RESULTS:
: (2, 4)