方法一:
-
-
vim /usr/lib/python2.6/tab.py
-
#!/usr/bin/env python
-
# python startup 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
-
-
# python2.6
-
>>> import tab
-
>>> import sys
-
>>> sys.path
-
>>> f = file('test')
-
>>> f.
f.__class__( f.__new__( f.encoding f.readinto(
f.__delattr__( f.__reduce__( f.errors f.readline(
f.__doc__ f.__reduce_ex__( f.fileno( f.readlines(
f.__enter__( f.__repr__( f.flush( f.seek(
f.__exit__( f.__setattr__( f.isatty( f.softspace
f.__format__( f.__sizeof__( f.mode f.tell(
f.__getattribute__( f.__str__( f.name f.truncate(
f.__hash__( f.__subclasshook__( f.newlines f.write(
f.__init__( f.close( f.next( f.writelines(
f.__iter__( f.closed f.read( f.xreadlines(
方法二:
-
编辑一个~/.py_tab.py(名字可任意起),输入以下内容:
-
import readline
import rlcompleter
readline.parse_and_bind("tab: complete")
-
设置环境变量~/.bashrc
-
export PYTHONSTARTUP=~/.py_tab.py
-
重启当前shell.
Windows 7下配置python3的tab补全功能;
-
#首先安装readline模块
-
pip install pyreadline
-
编辑C:\Python3\Lib\tab.py文件,内容如下:
-
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
-
阅读(1150) | 评论(0) | 转发(0) |