码迷,mamicode.com
首页 > 编程语言 > 详细

Python tab键命令补全

时间:2019-03-21 13:15:01      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:2.7   lse   pass   and   readline   ack   ges   lib   pat   

pip install pyreadline


import rlcompleter, readline  
readline.parse_and_bind(tab: complete)


root@peter-virtual-machine:/usr/lib/python2.7/dist-packages# cat tab.py
import rlcompleter
import readline
import atexit
import os
# http://stackoverflow.com/questions/7116038/python-tab-completion-mac-osx-10-7-lion
iflibeditin readline.__doc__:
    readline.parse_and_bind(bind ^I rl_complete)
else:
    readline.parse_and_bind(tab: complete)
    histfile = os.path.join(os.environ[HOME],.pyhist)
try:
    readline.read_history_file(histfile)
except IOError:
    pass
    atexit.register(readline.write_history_file, histfile)
    del readline, rlcompleter, histfile, os

 

Python tab键命令补全

标签:2.7   lse   pass   and   readline   ack   ges   lib   pat   

原文地址:https://www.cnblogs.com/icemonkey/p/10570941.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!