将OrgMode中的Python输出解析为选项卡

2024-05-16 19:19:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我试了一个小时,但没有得到预期的结果,所以我需要问你:

  • 我已经安装了24个Emacs
  • 我已经安装了python3.0

实际上,我试图通过orgmode将python输出解析为表:

#+begin_src python :session :results output table :exports results
print("|Example|")
print("|--------|")
print("|One example entry|")
#+end_src

当我将缓冲区导出为pdf/html时,我需要一个表。

然而,这并没有发生。

有人能修复我的代码并告诉我,为什么我的代码不起作用?

提前谢谢!


Tags: 代码srcoutputexamplesessiontableoneresults
1条回答
网友
1楼 · 发布于 2024-05-16 19:19:30

raw添加到:results头参数:

#+begin_src python :session :results output table raw :exports results
print("|Example|")
print("|    |")
print("|One example entry|")
#+end_src

来自the documentation

raw The results are interpreted as raw Org mode code and are inserted directly into the buffer. If the results look like a table they will be aligned as such by Org mode.

相关问题 更多 >