FrenchToast
FrenchToast

Reputation: 53

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:

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!

Upvotes: 5

Views: 799

Answers (1)

Chris
Chris

Reputation: 137114

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.

Upvotes: 4

Related Questions