python下的tab快捷键设置

将下面的进行保存为tab.py,并将此python保存到/usr/lib64/python2.7/目录下,

在交互模式下,每次调用时需要 import tab

import sys

import readline
import rlcompleter
import atexit
import os
# tab completion 
readline.parse_and_bind('tab: complete')
# history file 
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
    readline.read_history_file(histfile)
except IOError:
    pass
atexit.register(readline.write_history_file, histfile)


del os, histfile, readline, rlcompleter

你可能感兴趣的:(python)