Windows下Python tab键补全

###打开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

你可能感兴趣的:(Windows下Python tab键补全)