Issue
I am running some code in IPyton::
jrlab@jrlab-T150s:~$ ipython
In [1]: from IPython import get_ipython
...: ipython = get_ipython()
...:
...: code = """
...: import matplotlib.pyplot as plt
...:
...: print("bla")
...:
...: plt.figure()
...: """
...: res = ipython.run_cell(code)
...:
bla
Out[1]: <Figure size 640x480 with 0 Axes>
How do I disable the Out[1] printing, but not the printing commanded by the print statement?
Solution
None
is not printed as output. So just append ; None
to any line whose output you wish to suppress:
In [1]: 1+2
Out[1]: 3
In [2]: 1+2; None
In [3]:
Answered By - Amadan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.