1. Module call
Import Module from Import xx from Import xx as rename from Import *
2. Import the module you made
First of all, the module can only be used in the current path of the program can be imported, a directory and then import their own module will be error: module can not find
Analysis : This is related to the import path
Import SYS print(Sys.path)
workaround : The Python interpreter will follow the list order to match the module name to be imported, as long as it matches the module name in a directory, import it immediately, and no longer find it, so here, you want the Python interpreter to find the module to import, The path where the module is located should be added in
sys.path.append (' xxx ') # Example: sys.path.append (' classroom practice ') Import # the name of the module you make
Python's Common module learning