首页 > 代码库 > Python tab补全

Python tab补全

Linux系统中的Python tab补全脚本:

 1 #!/usr/bin/env python  2 # python startup file  3 import sys 4 import readline 5 import rlcompleter 6 import atexit 7 import os 8 # tab completion  9 readline.parse_and_bind(tab: complete)10 # history file 11 histfile = os.path.join(os.environ[HOME], .pythonhistory)12 try:13     readline.read_history_file(histfile)14 except IOError:15     pass16 atexit.register(readline.write_history_file, histfile)17 del os, histfile, readline, rlcompleter

 

写完之后将tab.py文件放到全局环境变量目录/usr/local/python35/lib/python3.5/site-packages/中就可以了

技术分享

 

此脚本Python2通用,按照同样的方法配置。

Python tab补全