1.code

#!/usr/bin/env/python
#_*_coding:utf-8_*_
#Data:17-10-08
#Auther:苏莫
#Link:http://blog.csdn.net/lingluofengzang
#PythonVersion:python2.7
#filename:tab.py

import sys
import readline
import rlcompleter
import atexit
import os


reload(sys)
sys.setdefaultencoding('utf-8')

# tab completion
readline.parse_and_bind('tab: complete')
# history file
# windows
histfile = os.path.join(os.environ['HOMEPATH'], '.pythonhistory')   
# linux
# 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 

2.安装第三方库

pip install pyreadline

3.存放位置

python安装文档位置下的Lib文件夹

4.测试环境

window

5.使用方法

使用时,脚本需要导入
import tab
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐