Friends who play Linux, still worry about Python's default no-tab completion?
Below is a solution in the next, hoping to help newcomers to the new school of Python.
First step: Write a one-click completion script tab.py
[Email protected]~] #vim tab.py
#!/usr/bin/env python
Import Sys
Import ReadLine
Import Rlcompleter
Import atexit
Import OS
#tab completion
Readline.parse_and_bind (' Tab:complete ')
Step Two: Enter Python interactive mode to view the selection order of the Python module import
[[email protected] ~]# python
Python 2.7.5 (Default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import Sys
>>> Sys.path
[', '/usr/lib64/python27.zip ', '/usr/lib64/python2.7 ', '/usr/lib64/python2.7/plat-linux2 ', '/usr/lib64/python2.7/ Lib-tk ', '/usr/lib64/python2.7/lib-old ', '/usr/lib64/python2.7/lib-dynload ', '/usr/lib64/python2.7/site-packages ' , '/usr/lib64/python2.7/site-packages/gtk-2.0 ', '/usr/lib/python2.7/site-packages ']
>>>
Step three: Copy one-click completion script to the Python module default path/usr/lib64/python2.7
[Email protected] ~]CP tab.py/usr/lib64/python2.7/
Fourth step: Import one-click completion module
[[email protected] ~]# python
Python 2.7.5 (Default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> Import Tab
>>> Import Sys
>>> sys. --Double tab
Sys.__class__ (Sys.exitfunc (
SYS.__DELATTR__ (sys.flags
...
This article is from the "Miao Sen" blog, please be sure to keep this source http://zhaom0109.blog.51cto.com/11675013/1888024
Super simple Python command line tab One-click completion method