python之 自动补全 tab

Posted 张冲andy

tags:

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

1、在python中运行命令sys.path查看python路径

>>> import sys
>>> import tab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tab


>>> sys.path
[‘‘, ‘/usr/lib64/python26.zip‘, ‘/usr/lib64/python2.6‘, ‘/usr/lib64/python2.6/plat-linux2‘, ‘/usr/lib64/python2.6/lib-tk‘, ‘/usr/lib64/python2.6/lib-old‘, ‘/usr/lib64/python2.6/lib-dynload‘, ‘/usr/lib64/python2.6/site-packages‘, ‘/usr/lib64/python2.6/site-packages/gst-0.10‘, ‘/usr/lib64/python2.6/site-packages/gtk-2.0‘, ‘/usr/lib64/python2.6/site-packages/webkit-1.0‘, ‘/usr/lib/python2.6/site-packages‘, ‘/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info‘]


2、创建 tab.py 文件
[[email protected] ~]# cd /usr/lib/python2.6/site-packages

[[email protected] site-packages]# cat tab.py
#!/usr/bin/python
# python tab file

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


3、 导入 tab 模块
>>> import tab
>>> f
file( filter( finally float( for format( from frozenset(
































以上是关于python之 自动补全 tab的主要内容,如果未能解决你的问题,请参考以下文章

Python基础 (tab自动补全)

Python Tab自动补全

python的tab自动补全

Python建立Tab自动补全的脚本

python tab 自动补全

python环境tab命令自动补全