1, TAB补全代码
#!/usr/bin/python #pyton 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 #end
2, 测试TAB代码
>>> import tab >>> import hello hello,world >>> hello hello >>> hello. -------这里敲TAB键补全 hello.__class__( hello.__hash__( hello.__repr__( hello.__delattr__( hello.__init__( hello.__setattr__( hello.__dict__ hello.__name__ hello.__sizeof__( hello.__doc__ hello.__new__( hello.__str__( hello.__file__ hello.__package__ hello.__subclasshook__( hello.__format__( hello.__reduce__( hello.a hello.__getattribute__( hello.__reduce_ex__( >>> hello.
转载于:https://blog.51cto.com/dingtongxue1990/1674271