Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

access to printed output

Maybe relating to this question: Access output from previous cells

Assume I defined a function that takes a string and prints it:

def f(s):
    print s
    return

Now the output of the cell

f('hello')

is just the word 'hello'.

Is there any way to access this output, for example read it as a variable?

The problem occurs when I have a MixedIntegerLinearProgram p and access it with p.show(). I then want to do something with the printed output of this command, e.g. write it to a file.