标签:
tab
用来实现python命令补全的py文件,把它当成一个模块使用
1 #!/usr/bin/python 2 import sys 3 import readline 4 import rlcompleter 5 import atexit 6 import os 7 # tab completion 8 readline.parse_and_bind(‘tab: complete‘) 9 # history file 10 histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘) 11 try: 12 readline.read_history_file(histfile) 13 except IOError: 14 pass 15 atexit.register(readline.write_history_file, histfile) 16 del os, histfile, readline, rlcompleter
将文件拷贝到python的包目录下,一般是python安装路径/lib64/python2.x目录下
使用:
import tab
标签:
原文地址:http://www.cnblogs.com/huangweimin/p/5051663.html