该命令补全脚本来自网络,把脚本放到特定的目录下,用的时候import进来就可以了
路径如下查找:
>>> os.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/lib/python2.6/site-packages‘]
把脚本放到/usr/lib64/python2.6/site-packages下即可
补全脚本:tab.py
#!/usr/bin/env python
# python startup file
import sys
import readline
import rlcompleter
import os
readline.parse_and_bind(‘tab: complete‘)
histfile = os.path.join(os.environ[‘HOME‘], ‘.pythonhistory‘)
时间: 2024-10-17 08:55:49