Python tab键命令补全

Posted 风追海浪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python tab键命令补全相关的知识,希望对你有一定的参考价值。

pip install pyreadline


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


[email protected]-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键命令补全的主要内容,如果未能解决你的问题,请参考以下文章

linux “命令行自动补全”功能用命令行怎么写

设置python中TAB键自动补全方法

华为命令中Tab键无法自动补全解决办法

python交互模式下命令tab补全

Unbuntu 14.4Tab键不能自动补全

Linux-tab键命令补全