You can obtain the result of the last expression in a Python REPL with the underscore operator, e.g. in the Python REPL this looks like:
>>> 3 * 3 9 >>> _ + 3 12
This works in the IPython shell too. In addition, the IPython shell allows you to use Out[n]
to get the value of the expression In[n]
. E.g., Out[1]
would give us the number 9 in the example below:
In [1]: 3 * 3 Out[1]: 9 In [2]: Out[1] + 3 Out[2]: 12 In [3]: _ + 3 Out[3]: 15