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.utils import io

with io.capture_output() as captured:
    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"