python命令行补全

说明蓝色=命令名称python

      浅绿=命令参数bash

      浅蓝=选项ide

      紫色=目录spa

      系统环境:CentOS  5.8  x86_64blog

      Python版本:2.7.3get

在用户宿主目录创建 .pythonstartup 文件内容以下:string

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

在宿主目录的 .bashrc 文件中加入环境变量:it

echo "export PYTHONSTARTUP=~/.pythonstartup" >> ~/.bashrcio

退出从新登陆,效果如图:class

相关文章
相关标签/搜索