python下的tab快捷键设置

来源:互联网 发布:香榭的落叶淘宝 编辑:程序博客网 时间:2024/06/07 07:16

将下面的进行保存为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
0 0