Jupyter notebook trick: recall last output cells

36 views
Skip to first unread message

Jay Wang

unread,
Sep 6, 2017, 12:14:01 PM9/6/17
to comphys
In Jupyter notebook, it's often handy to use the last few output cells without variable name reference. Here is how:
_: (underscore) recall the last output
__: (double underscore) recall the second last output
_x: recall the output number x

Example
In  [1]: a = 0.5
         a
Out [1]: 0.5
In  [2]: _
Out [2]: 0.5
In  [3]: __
Out [3]: 0.5
In  [4]: _1
Out [4]: 0.5
In  [5]: 3*_1
Out [5]: 1.5
Reply all
Reply to author
Forward
0 new messages