Python 3.2.3 and the following versions do not have their own tab completion, and the Python 3.5.1 comes with the tab completion module. #!/usr/bin/env python# python startup fileimport sysimport readlineimport rlcompleterimport atexitimport os# tab Completi Onreadline.parse_and_bind (' Tab:complete ') # History filehistfile = Os.path.join (os.environ[' HOME '], '. Pythonhistory ' ) Try:readline.read_history_file (histfile) except IOError:passatexit.register (Readline.write_history_file, Histfile) del os, Histfile, ReadLine, rlcompleter #for Linux import sysimport readlineimport rlcompleter If sys.platform = = ' Darwin ' and sys.version_info[0] = = 2:readline.parse_and_bind ("Bind ^i rl_complete") else:readline.parse_and_bind ("Tab:complete") # Linux and Python3 on Mac #for mac >>> import sys>>> print (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 '] >>>I write the tab.py module can only be imported in the current directory, if you want to use in any place in the system, to put this tab.py in the Python Global environment variable directory, is generally placed in the Python/2.7/site-packages directory, This directory does not have the same location in different OS, and print (Sys.path) allows you to view a list of Python environment variables. ", which represents the current path, first find the current path
Python's Way "first": Python Basics (5)