1. Create tab.py[[email protected] files]# cat tab.py#!/usr/bin/env python # python startup file import sysimport readlineimport rlcompleterimport Atexitimport 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: Passatexit.register (readline.write_history_file, histfile) Del os, histfile, readline, rlcompleter2. View python's default module storage address [[email protected] files]# pythonpython 2.7.8 ( default, dec 29 2016, 11:45:52) [GCC 4.4.7 20120313 (red hat 4.4.7-16)] on linux2type "Help", "copyright", "credits" or "license" for more information.>>> >>> import sys>>> sys.path[', '/usr/local/lib/python2.7/ Site-packages/setuptools-7.0-py2.7.egg ', '/usr/local/lib/python2.7/site-packages/ Markupsafe-0.9.3-py2.7-linux-x86_64.egg ', '/usr/local/lib/python2.7/site-packages/ Paramiko-1.15.1-py2.7.egg ', '/usr/local/lib/python2.7/site-packages/simplejson-3.6.5-py2.7-linux-x86_64. Egg ', '/usr/local/lib/python2.7/site-packages/ansible-2.0.0.0-py2.7.egg ', '/usr/local/lib/python2.7/ Site-packages/jinja2-2.8-py2.7.egg ', '/usr/local/lib/python27.zip ', '/usr/local/lib/python2.7 ', '/usr/local/lib/python2.7/plat-linux2 ', '/usr/local/lib/python2.7/lib-tk ', '/usr/local/lib/ Python2.7/lib-old ', '/usr/local/lib/python2.7/lib-dynload ', '/usr/local/lib/python2.7/site-packages ' ]3. Copy the script to the default module storage path [[email protected] files]# cp tab.py /usr/local/lib/python2.74 . test [[EMAIL PROTECTED] FILES]# PYTHONPYTHON 2.7.8  (default, dec 29 2016, 11:45:52) [GCC 4.4.7 20120313 (red hat 4.4.7-16)] on linux2type "Help", "copyright", "credits" or "license" for more information.>>> import tab>>> import sys> >> sys.sys.__class__ ( sys.__stdout__ Sys.exit (    SYS.PATH_HOOKSSYS.__DELATTR__ (   SYS.__STR__ ( sys.exitfunc ( sys.path_importer_cachesyS.__dict__ sys. __subclasshook__ ( sys.flags sys.platformsys.__displayhook__ ( sys._clear_type_cache ( sys.float_ info sys.prefixsys.__doc__ sys._ Current_frames ( sys.float_repr_style sys.ps1sys.__egginsert sys._getframe ( sys.getcheckintErval ( sys.ps2sys.__excepthook__ ( sys._mercurial sys.getdefaultencoding ( sys.py3kwarningsys.__format__ ( sys.api_version sys.getdlopenflags ( sys.setcheckinterval (sys.__getattribute__ ( sys.argv sys.getfilesystemencoding ( sys.setdlopenflags (sys.__hash__ ( sys.builtin_module_names Sys.getprofile ( sys.setprofile (sys.__init__ ( sys.byteorder sys.getrecursionlimit ( sys.setrecursionlimit (sys.__name__ sys.call_tracing ( sys.getrefcount ( sys.settrace (sys.__new__ ( sys.callstats ( sys.getsizeof ( Sys.stderr
Pyhton Tab Auto-complete