Learn python, often use the Python command line to find some unfamiliar use and so on, but the Python command line does not have the function of the tab completion, see someone else write the tab, you can resolve to write down, for later use
1. Create the tab.py file with the following content:
#!/usr/bin/env python#python startup fileImportSYSImportReadLineImportRlcompleterImportatexitImportOS#Tab CompletionReadline.parse_and_bind ('Tab:complete')#History FileHistfile = Os.path.join (os.environ['HOME'],'. Pythonhistory')Try: Readline.read_history_file (histfile)exceptIOError:PassAtexit.register (Readline.write_history_file, Histfile)delOS, Histfile, ReadLine, Rlcompleter
2. The code has, we also need to put the script in python specified directory, you can use Sys.path to see
>>>ImportSYS>>>sys.path["','/usr/lib/python2.7','/usr/lib/python2.7/plat-x86_64-linux-gnu','/USR/LIB/PYTHON2.7/LIB-TK','/usr/lib/python2.7/lib-old','/usr/lib/python2.7/lib-dynload','/usr/local/lib/python2.7/dist-packages','/usr/lib/python2.7/dist-packages','/usr/lib/python2.7/dist-packages/pilcompat','/usr/lib/python2.7/dist-packages/gtk-2.0','/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
In general we will put this type of code in the/usr/local/lib/python2.7/dist-packages directory
3. Place the tab.py in the specified directory
MV Tab. /usr/local/Lib/python2. 7/Dist-packages
4. Use
>>>ImportTab>>>Sys.sys.__class__(sys.__subclasshook__(Sys.exitfunc (Sys.path_importer_cachesys.__delattr__(Sys._clear_type_cache (sys.flags sys.platformsys.__dict__sys._current_frames (sys.float_info sys.prefixsys.__displayhook__(Sys._getframe (Sys.float_repr_style sys.ps1sys.__doc__sys._mercurial sys.getcheckinterval (sys.ps2sys.__excepthook__(Sys._multiarch sys.getdefaultencoding (Sys.py3kwarningsys.__format__(sys.api_version sys.getdlopenflags (Sys.pydebugsys.__getattribute__(sys.argv sys.getfilesystemencoding (Sys.setcheckinterval (sys.__hash__(Sys.builtin_module_names sys.getprofile (sys.setdlopenflags (sys.__init__(Sys.byteorder sys.getrecursionlimit (sys.setprofile (sys.__name__sys.call_tracing (Sys.getrefcount (Sys.setrecursionlimit (sys.__new__(Sys.callstats (sys.getsizeof (Sys.settrace (sys.__package__sys.copyright sys.gettrace (sys.stderrsys.__reduce__(Sys.displayhook (sys.hexversion sys.stdinsys.__reduce_ex__(Sys.dont_write_bytecode sys.long_info sys.stdoutsys.__repr__(Sys.exc_clear (sys.maxint sys.subversionsys.__setattr__(Sys.exc_info (sys.maxsize sys.versionsys.__sizeof__(Sys.exc_type sys.maxunicode sys.version_infosys.__stderr__Sys.excepthook (Sys.meta_path sys.warnoptionssys.__stdin__sys.exec_prefix sys.modules sys.__stdout__sys.executable sys.path sys.__str__(Sys.exit (Sys.path_hooks
Python tab Auto-complete