emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Suppressing interpeter output in code blocks


From: Michael Steeves
Subject: Re: [O] Suppressing interpeter output in code blocks
Date: Thu, 06 Jun 2013 14:08:47 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 6/6/13 12:04 PM, Eric Schulte wrote:
> Michael Steeves <address@hidden> writes:
>> Is there any way to suppress all the extra text, and just get the
>> "Hello, world." string as my output?
>>
> 
> #+begin_src python :session testing
> a = 1
> b = 2
> c = a + b
> "Hello, world."
> #+end_src
> 
> #+RESULTS:
> : Hello, world.

Thanks for the reply. Unfortunately I need to set :results to output,
since I'm working with a doc where I'm working through a python script,
and want to run a section, get some output and write some additional
text, then move on to the next block (and all within a session, since
block 2 depends on things from block 1, and so on.

I put together a more descriptive example, but interestingly enough I'm
now getting some inconsistent output when I evaluate the source blocks.

#+BEGIN_SRC python :session testing :results output
print "Hello, World."
print "This is a test."
#+END_SRC

#+RESULTS:
: Hello, World.
: This is a test.

#+BEGIN_SRC python :session testing :results output
a = 1; b = 2
print "A is "+str(a)
print "B is "+str(b)
#+END_SRC

#+RESULTS:
:
: A is 1
: B is 2

#+BEGIN_SRC python :session testing :results output
c = a + b
print "C is "+str(c)
print "Now we're done."
#+END_SRC

#+RESULTS:
:
: C is 3
: Now we're done.

#+BEGIN_SRC python :session testing :results output
y = 3
z = 4
print "Y is "+str(y)
print "Z is "+str(z)
#+END_SRC

#+RESULTS:
:
: >>> Y is 3
: Z is 4

I don't understand why the last chunk provides different output than the
second -- the only real difference is that I put the assignments on one
line (seperated with a semicolon) in the second, and on individual lines
in the last.


-Mike
-- 
Michael Steeves (address@hidden)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]