1. In each package of the python module, There Is A _ init _. py file. Each Python package must contain this file. If _ init _. py does not exist, this directory is just a directory, rather than a package, and cannot be imported or contain other modules and nested packages.
2. A package is usually a directory except _ init __. in addition to the py file, there are some module files and subdirectories. If the subdirectory also contains _ init __. PY, It is the sub-package of this package.
3.The _ init _. py file will be executed when the package is imported.
4. The _ init _. py file defines the package attributes and methods. In fact, it can not be defined; it can be just an empty file, but it must exist. Another important variable in _ init _. py is called _ all __. Sometimes we make a trick to "import all", and import will register it in the package _ init __. import the sub-modules and sub-packages in the _ all _ list of The py file to the current scope.
Note that the __init _. py file is completely different from the _ init _ method. The _ init _ method automatically runs immediately when an object of the class is created. Therefore, the _ init _ method can be used to initialize your object.