Since default value for :result header is value print statement will only show with :result output
#+BEGIN_SRC python :results output print(' hello') #+END_SRC #+RESULTS: : hello but same thing in session is trimming whitespace trailing and preciding like python str.strip() method.
#+BEGIN_SRC python :results output :session test print(' hello') #+END_SRC #+RESULTS: : hello according to manual in Results-of-Evaluation verbatim which should Interpret literally seem only to work with value as stated in manual's usage example: ‘:results value verbatim’ will not show output of print. How to stop the output being trimmed in session.
#+BEGIN_SRC python :results value verbatim :session test print(' hello') #+END_SRC #+RESULTS:
valuewon't work:For languages like Python, an explicit return statement is mandatory when using ‘:results value’. Result is the value returned by the last statement in the code blocks = " hello"and puttingson the last line with:results valuedoes work though, but not a desirable solution:sessionheader?org-trimand you're using:sessionto share and/or combine code from seperate blocks that are not using#+NAME:or:noweb-refheaders correct? If the only reason for using:sessionis to combine code from separate blocks then using literate programming features instead of:sessionmight also be a viable alternative solution.