Search the command history - Python Shell

Tim Chase python.list at tim.thechases.com
Wed Mar 19 06:07:50 EDT 2008


> Are there any simillar key combination in Python Shell like Linux Ctrl+R
> (reverse-i-search) to search the command history?


It must depend on how your version of Python was built...mine 
here on my Linux box has exactly that functionality.  I press ^R 
and start typing, and the line comes up from my typed history.

bash$ python2.4
Python 2.4.4 (#2, Jan  3 2008, 13:36:28)
[GCC 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
 >>> a = 42
(reverse-i-search)`a': a = 42


bash$ python2.5
Python 2.5.2a0 (r251:54863, Feb 10 2008, 01:31:28)
[GCC 4.2.3 (Debian 4.2.3-1)] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
 >>> a = 42
(reverse-i-search)`a': a = 42


-tkc





More information about the Python-list mailing list