I am using IPython 2.7. I wish to print last 3 or 5 or in general 'n' commands. The %hist
command prints all the commands till now. Note, here, by 'n' I do not refer to line numberings (i.e. IPython's indexing of each line).
To get the last 5 commands:
%hist -l 5
You can see all the arguments that %hist
supports by typing %history?
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With