Let the python command line also complete automatically
- 2020-04-02 14:27:06
- OfStack
Many people know that iPython has great auto-completion capabilities, but not necessarily that python can also do Tab completion,
You can execute it after starting python
import readline, rlcompleter; readline.parse_and_bind("tab: complete")
Now I can hit Tab to complete it.
Since the launch of the python
If you're going to have to type this every time, you can write the top line to ~/.pythonstartup.py,
Add an environment variable to ~/.bashrc
Export PYTHONSTARTUP=~/.pythonstartup.py and this will execute python every time it starts