![Python tab键自动补齐 Python tab键自动补齐](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
1、进入root家目录 建立.tab文件
.tab文件内容如下:
##############################################
import sys
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab: complete')
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
##############################################
##############################################
2、vi /root/.bashrc
export PYTHONSTARTUP=~/.tab
3、重新获取环境变量
. .bashrc
4.测试如下
进入 python 里 首先导入 刚才的模块tab
如图:
![Python tab键自动补齐 Python tab键自动补齐](https://image.shishitao.com:8440/aHR0cDovL2ltYWdlcy5jbml0YmxvZy5jb20vYmxvZy83MjA3ODUvMjAxNTAyLzA0MTcyNzAxMjgxNTY0Mi5wbmc%3D.png?w=700&webp=1)