In interactive mode, Python presses the TAB key for the function output of the Time tab key when entering a command, which is inconvenient when writing python.
Write the following code into a file tab.py, and put it under/usr/lib/python2.6/site-packages/.
#!/usr/bin/env pythonimport sysimport readlineimport rlcompleterimport atexitimport osreadline.parse_and_bind (' tab: Complete ') Histfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ') try:readline.read_history_file (histfile) Except Ioerror:pass Atexit.register (Readline.write_history_file,histfile)
How to use:
Python enters interactive mode:
>>> import tab>>> import sys>>> sys.sys.__class__ ( sys.api_version            SYS.HEXVERSIONSYS.__DELATTR__ ( sys.argv sys.last_type (sys.__dict__ sys.builtin_module_ names sys.last_valuesys.__displayhook__ ( sys.byteorder sys.maxintsys.__doc__ sys.call_tracING ( sys.maxsizesys.__egginsert sys.callstats ( sys.maxunicodesys.__excepthook__ ( sys.copyright sys.meta_pathsys.__format__ ( sys.displayhook (   SYS.MODULESSYS.__GETATTRIBUTE__ ( sys.dont_write_bytecode sys.pathsys.__hash__ ( sys.exc_clear ( sys.path_hookssys.__init__ ( Sys.exc_info ( sys.path_importer_cachesys.__name__ sys.exc_type sys.platformsys.__new__ ( sys.excepthook ( sys.prefixsys.__package__ sys.exec_prefix sys.ps1sys.__plen sys.executable              SYS.PS2SYS.__REDUCE__ ( sys.exit ( Sys.py3kwarningsys.__reduce_ex__ ( sys.exitfunc ( sys.setcheckinterval (Sys.__repr__ ( sys.flags sys.setdlopenflags (sys.__setattr__ ( sys.float_info sys.setprofile (sys.__sizeof__ ( &nbsP; sys.getcheckinterval ( sys.setrecursionlimit (sys.__stderr__ sys.getdefaultencoding ( sys.settrace (sys.__stdin__ sys.getdlopenflags ( sys.stderrsys.__stdout__ sys.getfilesystemencoding ( sys.stdinsys.__str __ ( Sys.getprofile ( sys.stdoutsys.__ Subclasshook__ ( sys.getrecursionlimit ( sys.subversionsys._clear_tYpe_cache ( sys.getrefcount ( sys.versionsys._current_frames ( Sys.getsizeof ( sys.version_ Infosys._getframe ( Sys.gettrace ( Sys.warnoptions>>> sys.
This makes it easy to view the function modules.
This article is from the "Operation Utopia" blog, please make sure to keep this source http://joeyang.blog.51cto.com/9092193/1542965