Watch video Show teacher Python can tab complement, find a piece of code online
As follows:
[[email protected] data] #vi tab.py
1 #!/usr/bin/env python2 #python startup file3 ImportSYS4 ImportReadLine5 ImportRlcompleter6 Importatexit7 ImportOS8 #Tab Completion9Readline.parse_and_bind ('Tab:complete')Ten #History File OneHistfile = Os.path.join (os.environ['HOME'],'. Pythonhistory') A Try: - readline.read_history_file (histfile) - exceptIOError: the Pass - Atexit.register (Readline.write_history_file, Histfile) - delOS, Histfile, ReadLine, Rlcompleter
Copy to Python command path
[[email protected] data] #cp tab.py/usr/lib64/python2.6
Import
[[email protected] data]# python
Python 2.6.6 (r266:84292, 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import Tab
>>> Import Sys
>>> SYS.P
Sys.path Sys.platform SYS.PS2
Sys.path_hooks Sys.prefix sys.py3kwarning
Sys.path_importer_cache SYS.PS1
Python tab completion