Skip to content Skip to sidebar Skip to footer

Ipython Notebook Avoid Printing Within A Function

I want to prevent a function to print in iPython notebook. In standard python one can prevent printing some lines of code as answered in the question: To prevent a function from p

Solution 1:

You could use io.capture_output:

from IPython.utilsimport io

with io.capture_output() ascaptured:
    foo()

to capture stdout and stderr for only those lines within the with-statement.

Post a Comment for "Ipython Notebook Avoid Printing Within A Function"