简体   繁体   English

将OrgMode中的Python输出解析为表

[英]Parse Python Output in OrgMode to a table

I tried now for one hour and I don't get the result I expect, so I need to ask you here: 我现在尝试了一个小时,但没有得到预期的结果,所以我需要在这里问您:

  • I have Emacs 24 installed 我已经安装了Emacs 24
  • I have Python 3.0 installed 我已经安装了Python 3.0

Actually I try to parse a python output to a table via orgmode: 实际上,我尝试通过orgmode将python输出解析为表:

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

I expect a table when I export the buffer to pdf/html. 当我将缓冲区导出到pdf / html时,我希望有一张表。

However this does not happen. 但是,这不会发生。

Can anyone fix my code and tell me, why mine does not work? 谁能修复我的代码并告诉我,为什么我的代码不起作用?

Thanks in advance! 提前致谢!

Add raw to your :results header arguments: raw添加到您的:results标头参数中:

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

From the documentation : 文档中

raw The results are interpreted as raw Org mode code and are inserted directly into the buffer. raw结果被解释为原始Org模式代码,并直接插入到缓冲区中。 If the results look like a table they will be aligned as such by Org mode. 如果结果看起来像一张桌子,它们将按组织模式进行对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM