To make the code reusable, please modularize it!
Module is a program
Importing module Import sys
Tell the interpreter where to look for the module: sys.path.append (' Directory for module storage ')
Importing a module does not mean that some operations (such as printing text) are performed at the time of import, and they are used primarily for definition, such as variable functions or classes
When the module is imported, the import module once and the import module multiple times the effect is the same
Why is it? Because there will be two modules imported to each other, a import b,b import a,a import b,b Import a ...
Into a dead loop because nothing happens when you import the module for the second time, so the loop terminates
At that time, if you had to reload the module, you could use the built-in reload function, which has a parameter (the module to re-like) and returns the module again
Named modules: plus the suffix name of the. Py
Package: The package is the directory where the module is located, in order for Python to treat it as a package must contain a file named __init__.py (module) within the package
This article is from the "Make a few" blog, be sure to keep this source http://9399369.blog.51cto.com/9389369/1605278
Modules in Python