Python Interpreter Auto Completion
lufy
October 31, 2017
In linux bash, and django ./manage.py shell, double click TAB key would get auto completion. However, the default python interpreter has no such function, but fortunately, this could be added with steps next:
vim /usr/lib/python2.7/site-packages/tab.py
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab:complete')
histfile = os.path.join(os.environ['HOME'],'.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
Then import tab module, TAB key well be valid.
~]# python
Python 2.7.5
......
>>> import tab
>>> ...
Comments (0)
Leave a Comment
No comments yet. Be the first to comment!