ubuntu python2.7 tab补全
2019-05-18 15:08 C#成长路 阅读(78) 评论(0) 收藏 举报1.解决方案:自行导入tab键的模块--创建tab.py模块文件
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 pass 16 atexit.register(readline.write_history_file, histfile) 17 del os, histfile, readline, rlcompleter
2.tab.py文件放到/usr/lib/python2.7
3.先在python的交互界面中导入一下
1 xpleaf@py:~/seminar6/day1$ python 2 Python 2.7.3 (default, Aug 1 2012, 05:14:39) 3 [GCC 4.6.3] on linux2 4 Type "help", "copyright", "credits" or "license" for more information. 5 >>> import sys ===>导入sys模块只是为了下面对tab键补全做测试 6 >>> import tab ===>这才是重点
浙公网安备 33010602011771号