python中tab补全脚本

一、创建tab.py文件,将以下脚本内容复制到该文件中

#!/usr/bin/python
# python tab 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        

二、进入python ,导入sys和tab.py

improt sys

improt tab

三、tab补全可用    

猜你喜欢

转载自blog.csdn.net/qq_17805763/article/details/80773294