How do I repeat the last command? The usual keys: Up, Ctrl+Up, Alt-p don't work. They produce nonsensical characters.
(ve)[kakarukeys@localhost ve]$ python
Python 2.6.6 (r266:84292, Nov 15 2010, 21:48:32)
[GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello world"
hello world
>>> ^[[A
File "<stdin>", line 1
^
SyntaxError: invalid syntax
>>> ^[[1;5A
File "<stdin>", line 1
[1;5A
^
SyntaxError: invalid syntax
>>> ^[p
File "<stdin>", line 1
p
^
SyntaxError: invalid syntax
>>>
ALT + p works for me on Enthought Python in Windows.
On Mac with Python 2.x
➜ ~ brew install rlwrap
Start with rlwrap
➜ ~ rlwrap python
Ipython isn't allways the way... I like it pretty much, but if you try run Django shell with ipython. Something like>>>
it does'n work correctly if you use virtualenv. Django needs some special includes which aren't there if you start ipython, because it starts default system python, but not that virtual.
I use the following to enable history on python shell.
This is my .pythonstartup file . PYTHONSTARTUP environment variable is set to this file path.
You will need to have the modules readline, rlcompleter to enable this.
Modules required:
it is control + p in Mac os in python 3.4 IDEL
You didn't specific which interpreter. Assuming you are using IDLE.
From IDLE documentation: Command history: