Python (Win)readline和tab补全的安装
浏览量:1217
1、安装readline
python -m pip install pyreadline
2、编写tab.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
__Author__ = "YoungCheung"
import sys
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab: complete')
# 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, rlcompleter3、保存文件并放到Python Lib下(如:C:\Python27\Lib)
4、测试效果
import tab


神回复
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。