1, write a tab of the automatic completion of the script, named tab.py
#!/usr/bin/python#python tab completeImportSYSImportReadLineImportRlcompleterImportatexitImportOS#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. View Python's module path information in Python
>>>ImportSYS>>>sys.path["','/usr/lib/python26.zip','/usr/lib/python2.6','/usr/lib/python2.6/plat-linux2','/USR/LIB/PYTHON2.6/LIB-TK','/usr/lib/python2.6/lib-old','/usr/lib/python2.6/lib-dynload','/usr/lib/python2.6/site-packages','/usr/lib/python2.6/site-packages/gst-0.10','/usr/lib/python2.6/site-packages/gtk-2.0','/usr/lib/python2.6/site-packages/webkit-1.0']>>>
The Python module is placed under/USR/LIB/PYTHON26 and the script is copied to the directory and imported when it is used.
3. Import tab
Import tab>>>or N)
4, but the path order of Python read module first is starting from the current directory, so if the current directory also exists tab.py, but the content of different Python script, it may be error, so in the environment variable also specify tab.py script
# For pythonexport pythonstartup=/usr/lib/python2.6/tab.py
Python command line Add Tab key Auto complete