gpt4 book ai didi

python - 将 OrgMode 中的 Python 输出解析为表

转载 作者:行者123 更新时间:2023-12-03 16:43:32 25 4
gpt4 key购买 nike

我现在尝试了一个小时,没有得到我期望的结果,所以我需要在这里问你:

  • 我安装了 Emacs 24
  • 我安装了 Python 3.0

  • 实际上,我尝试通过 orgmode 将 python 输出解析为表:
    #+begin_src python :session :results output table :exports results
    print("|Example|")
    print("|--------|")
    print("|One example entry|")
    #+end_src

    当我将缓冲区导出到 pdf/html 时,我希望有一个表格。

    然而,这不会发生。

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

    提前致谢!

    最佳答案

    添加 raw给您的 :results header 参数:

    #+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.

    关于python - 将 OrgMode 中的 Python 输出解析为表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31921819/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com