Skip to content

Instantly share code, notes, and snippets.

@seamustuohy
Created May 1, 2015 17:43
Show Gist options
  • Save seamustuohy/2a7d36b2bb4f57c7ac74 to your computer and use it in GitHub Desktop.
Save seamustuohy/2a7d36b2bb4f57c7ac74 to your computer and use it in GitHub Desktop.
Creating a table with headers in org-mode from a python babel source code block using ```None``` object
* Results
#+RESULTS: header_test
* Code :noexport:
#+NAME: header_test
#+BEGIN_SRC python :var header=header_items :var rows=row_items :exports results :output table
hdr = []
tbl = []
for i in header:
hdr.append(i)
tbl.append(hdr)
tbl.append(None) #This creates a hline that creates the header line
for i in rows:
tbl.append([i])
return tbl
#+END_SRC
** DATA
#+NAME: row_items :export none
- row 1
- row 2
- row 3
- row 4
- row 5
- row 6
- row 7
- row 8
#+NAME: header_items
-
- column 01
- column 02
- column 03
- column 04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment