Packages and modules:
Module import, the module (XXX. py is compiled into XXX. PyC, so that you can directly use it next time)
Path of the python search module:
1)ProgramMain directory
2) ptyhonpath directory (if it has been set)
3) Standard Connection Library directory (usually in/usr/local/lib/python2.x /)
4) content of any. PTH file (if any). The new function allows users to add effective directories to the module search path.
List directories in one row in a text file with the. PTH suffix.
The four components are combined into SYS. Path.
The module is a python file that can be imported;
A package is a bunch of modules and sub-packages organized by directory. The directory must contain the _ init _. py package information file, which can be empty.
To create a package, create a folder named "package name" and create _ init __. you can store script files, compiled extensions, and sub-packages and import packages in this folder as needed. module.
Package and module import method:
1. Import, but when calling the import module method, you need to write "module name. Method"
2. Import XX as a to get the module alias
3. From module import method. To call the module method, you only need to write "method"
Built-in attributes:
_ Name _ indicates the class name in the class declaration. "_ main _" is returned for this class call. If it is called after other classes are imported, the class name is returned.
_ Bases _ is used as the base class Object tuples in the class declaration;
_ Dict _ the dictionary object used to save other attributes;
_ Doc _ class documents;
_ Module _ define the Module name of the class;