Closed microamp closed 6 years ago
The default in Org is for Python snippets to export the code, not the results. (Some other languages are different, e.g. ditaa, where exporting the results is the default.) You can export the results too by adding a property:
- Some Python example here
#+BEGIN_SRC python :exports both
import operator
result = reduce(operator.add, range(1, 5))
return result
#+END_SRC
#+RESULTS:
: 10
results in
* Some Python example here
{code:title=|language=none|collapse=false}import operator
result = reduce(operator.add, range(1, 5))
return result
{code}
{noformat}
10
{noformat}
and you can also get just the results like so:
- Some Python example here
#+BEGIN_SRC python :exports results
import operator
result = reduce(operator.add, range(1, 5))
return result
#+END_SRC
#+RESULTS:
: 10
which results in:
* Some Python example here
{noformat}
10
{noformat}
If you specifically want the results to be code rather than "noformat" you can add another property to the code example: :results code
, like so:
- Some Python example here
#+BEGIN_SRC python :exports both :results code
import operator
result = reduce(operator.add, range(1, 5))
return result
#+END_SRC
#+RESULTS:
#+BEGIN_SRC python
10
#+END_SRC
It will output the following in JIRA format:
* Some Python example here
{code:title=|language=none|collapse=false}import operator
result = reduce(operator.add, range(1, 5))
return result
{code}
{code:title=|language=none|collapse=false}10
{code}
Does this solve your problem?
Input:
Output:
I think
can be inside a code snippet. e.g.