a module
㈠ What is a module?
A module is a file that contains the Python definition and declaration, and the filename is the suffix of the module name plus the. Py.
Why do ㈡ use modules?
If you quit the Python interpreter and then re-enter, then the functions or variables you defined previously will be lost, so we usually write the program to a file so that it can be persisted and executed in Python test.py when needed, when test.py is called a scripting script.
With the development of the program, more and more functions, in order to facilitate management, we usually divide the program into a file, so that the structure of the program is clearer and easier to manage. In this case, we can not only use these files as scripts to execute, but also as a module to import into other modules, to achieve the reuse of functionality,
㈢ How do I use modules?
1 Import
2 from ... import ...
3 module as script execution
4 Module Search Path
5 compiling Python files
6 standard modules
7 dir () function
Two packs
1 Import
2 from ... import ...
3 __init__.py file
4 from GLANCE.API import *
5 Absolute Import and relative import
6 Importing packages individually
Python basic----modules, packages