1. 程式人生 > >python中TAB補全

python中TAB補全

erro rtu reg 代碼 ioe exce code usr del

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

然後將tab.py文件放在D:/software/python/Lib/site-packages目錄下

運行python就可以TAB補全了

python中TAB補全