码迷,mamicode.com
首页 > 编程语言 > 详细

python tab实现

时间:2015-11-26 19:20:42      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:python   except   

小方法,在这里共享一下。


[root@web-02 dist-packages]# python

Python 2.7.5 (default, Jun 17 2014, 18:11:42) 

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import tab

>>> exit()



[root@web-02 dist-packages]# tail -n 1 /etc/profile   //文件路径,source下

export PYTHONSTARTUP=/usr/lib/python2.7/dist-packages/tab.py



[root@web-02 dist-packages]# cat tab.py

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

[root@web-02 dist-packages]# 


python tab实现

标签:python   except   

原文地址:http://7179867.blog.51cto.com/7169867/1717186

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!