建立.pythonstartup文件
$ cat .pythonstartup # cat ~/.pythonstartup # python startup file #!/usr/bin/env python import sys import readline import rlcompleter import atexit import os # tab completion readline.parse_and_bind('tab: complete')
# history file 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
定义变量到~/.bash_profile
$ echo 'export PYTHONSTARTUP=~/.pythonstartup' >> ~/.bash_profile
最后重新登陆,输入python进入交互模式,就可以用Tab键进行补全
原文来自:
本文地址://gulass.cn/python-auto-tab.html编辑:向云艳,审核员:逄增宝
Linux大全:
Linux系统大全: