I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
I often use Python 3000's interactive interpreter, but it's missing the convenience of tab-completion I'm used to from ipython, which isn't available for Python 3.x.
How do I enable tab completion in all of them, 2.6 and 3.x?
First, create a new file called
.pythonstartup.py
in your home directory. Put the following script in it:The parentheses around the string ensure that it works with both Python 2 and Python 3.
Every time the interactive interpreter is started, it executes a script defined in
$PYTHONSTARTUP
, if there is one. To set it to execute the above script, typeYou should write this line to your
.bashrc
or.bash_profile
file, so that it's automatically executed when a new shell is started.