Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
  • I have Python 3.0 installed

Actually I try to parse a python output to a table via orgmode:

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

However this does not happen.

Can anyone fix my code and tell me, why mine does not work?

Thanks in advance!

like image 911
FrenchToast Avatar asked Sep 28 '22 02:09

FrenchToast


1 Answers

Add raw to your :results header arguments:

#+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. If the results look like a table they will be aligned as such by Org mode.

like image 71
Chris Avatar answered Oct 21 '22 20:10

Chris