标签:color linux div ioerror 执行 style 补全 python3 exit
1,首先打开cmd窗口执行以下命令安装readline模块
python -m pip install pyreadline
2,编写 tab.py
1 #python Tab 2 import sys 3 import readline 4 import rlcompleter 5 import atexit 6 import os 7 readline.parse_and_bind(‘tab: complete‘) 8 # windows 9 histfile = os.path.join(os.environ[‘HOMEPATH‘], ‘.pythonhistory‘) 10 # linux 11 # histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘) 12 try: 13 readline.read_history_file(histfile) 14 except IOError: 15 pass 16 atexit.register(readline.write_history_file, histfile) 17 18 del os, histfile, readline, rlcompleter
放到Python安装目录
比如我的python安装在C:\Python3 目录
放到同级目录C:\Python3\tab.py
3,测试
标签:color linux div ioerror 执行 style 补全 python3 exit
原文地址:http://www.cnblogs.com/pyshell/p/7259824.html