2019-02-25

window环境使用tab键

安装pyreadline

pip install pyreadline

第二步:在安装目录Lib目录下添加tab.py

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

展示:

你可能感兴趣的:(2019-02-25)