[IPython-user] query replace

Fernando.Perez at colorado.edu Fernando.Perez at colorado.edu
Thu Sep 15 09:53:35 CDT 2005

Quoting John Hunter <jdhunter at ace.bsd.uchicago.edu>:

> Is there a way in ipython to replace all instances of string1 in the
> current input line with string2, outside of using it in emacs, of
> course....

Do you mean while you are editing?  In that case I don't think so.  But you can
do this:

In [3]: print "hi John"
hi John

In [4]: exec In[1].replace('John','Johnny')
hi Johnny

I don't know if this qualifies.  It also may be that readline provides replace
capabilities, but I don't think it does.


More information about the IPython-user mailing list