7

I would like IPython Notebook to display every line output without explicitly using the print command. Example:

a, b, c = 1, 2, 4

a

b

c

would only display 4 in the output cell, but I would like it to display

1

2

4

Is there a way to do this? I would also be able to selectively suppress some lines (by using ;?)

5

2 Answers 2

12

The answer is

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

Type that on a cell, run it, and from then on each command will display its own output. source

enter image description here

If you don't want to see the output of a particular command, just end it with ";" source

Sign up to request clarification or add additional context in comments.

Comments

0

This isn't exactly what you're looking for, but if you just want to see the output of multiple variables, you can list the expressions with comma in between: a, b, c would display 1, 2, 4

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.