python 命令行 tab 功能

Posted on Posted in python

> code

  1. import sys  
  2. import readline  
  3. import rlcompleter  
  4. import atexit  
  5. import os  
  6.   
  7. # tab completeion  
  8. readline.parse_and_bind('tab: complete')  
  9. # history file  
  10. histfile = os.path.join(os.environ['HOME'],'.pythonhistory')  
  11. try:  
  12.     readline.read_history_file(histfile)  
  13. except IOError:  
  14.     pass  
  15. atexit.register(readline.write_history_file, histfile)  
  16.   
  17. del os, histfile, readline, rlcompleter  
» 转载请注明来源:若我若鱼 » python 命令行 tab 功能

Leave a Reply

Your email address will not be published. Required fields are marked *

15 − eight =