#!/usr/bin/env python
# python startup file
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
把这个tab.py放到python全局环境变量目录里啦,用sys.path可以查看,ubuntu是在/usr/lib/python2.7/dist-packages/,centos是在/usr/lib/python2.7/site-packages/
如无特殊说明,文章均为本站原创,转载请注明出处
- 转载请注明来源:python tab补全代码
- 本文永久链接地址:http://www.hongxiaowei.com/xiaowei/667.html