標籤:ack hit try inf hat rac display exp max
#需求
為了方便工作,我們需要在Python終端下添加Tab健補全功能
#存放指令碼路徑
Pyhton2.6
/usr/lib/python2.6/site-packages/
Python2.7
/usr/lib/python2.7/dist-packages/
#指令碼代碼
[[email protected] ~]# cat /usr/lib/python2.6/site-packages/tab.pytry: import readlineexcept ImportError: print("Module readline not available.")else: import rlcompleter readline.parse_and_bind("tab: complete")
#bashrc檔案配置
[[email protected] ~]# tail -1 /etc/bashrcexport PYTHONSTARTUP="/usr/lib/python2.6/site-packages/tab.py"
#登出重新登陸
[[email protected] ~]# login
#測試
[[email protected] ~]# pythonPython 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.sys.__class__( sys.argv sys.maxintsys.__delattr__( sys.builtin_module_names sys.maxsizesys.__dict__ sys.byteorder sys.maxunicodesys.__displayhook__( sys.call_tracing( sys.meta_pathsys.__doc__ sys.callstats( sys.modulessys.__excepthook__( sys.copyright sys.pathsys.__format__( sys.displayhook( sys.path_hookssys.__getattribute__( sys.dont_write_bytecode sys.path_importer_cachesys.__hash__( sys.exc_clear( sys.platformsys.__init__( sys.exc_info( sys.prefixsys.__name__ sys.exc_type sys.ps1sys.__new__( sys.excepthook( sys.ps2sys.__package__ sys.exec_prefix sys.py3kwarningsys.__reduce__( sys.executable sys.setcheckinterval(sys.__reduce_ex__( sys.exit( sys.setdlopenflags(sys.__repr__( sys.flags sys.setprofile(sys.__setattr__( sys.float_info sys.setrecursionlimit(sys.__sizeof__( sys.getcheckinterval( sys.settrace(sys.__stderr__ sys.getdefaultencoding( sys.stderrsys.__stdin__ sys.getdlopenflags( sys.stdinsys.__stdout__ sys.getfilesystemencoding( sys.stdoutsys.__str__( sys.getprofile( sys.subversionsys.__subclasshook__( sys.getrecursionlimit( sys.versionsys._clear_type_cache( sys.getrefcount( sys.version_infosys._current_frames( sys.getsizeof( sys.warnoptionssys._getframe( sys.gettrace( sys.api_version sys.hexversion >>> sys.
Python終端下添加tab健補全功能