自动化测试自动化测试自动化测试

Windows下Python tab键补全

2017-10-24  本文已影响41人  指间_流年

###打开CMD,安装readline模块###

Python -m pip install pyreadline

###在C:\Python27\Lib下新建tab.py文件,内容如下###

#python Tab

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, rlcompleter

上一篇下一篇

猜你喜欢

热点阅读