[IPython-dev] Getting the Input History

Thomas Kluyver takowl at gmail.com
Wed Jan 18 10:23:54 EST 2017


On 18 January 2017 at 14:09, Carl Smith <carl.input at gmail.com> wrote:

> Is there a nice way to get the input history as a list?
>

Yep, it's accessible as _ih inside IPython. For a magic command or
something, you can get it as: shell.history_manager.input_hist_raw


> I'd like to create a magic, named something like *squash*, that basically
> combines the previous *n* inputs into a single string that can then be
> edited as one input. For example, entering these three lines...
>

The %recall magic can already do something similar with a range of input
numbers, e.g. %recall 1-3 5 7 should give you a new prompt with inputs 1-3,
5 and 7.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20170118/321ad5e5/attachment.html>


More information about the IPython-dev mailing list