Modules, exceptions, operating environments, MYSQLDB
Module:
Top-level files: As the entire file of the program portal, is responsible for calling other files in the code to implement the program flow function, called the top-level program files,
Module Files 1
Module Files 2
In Python everything is object, so the module is also an object, which means that the module has properties and methods.
All variables defined on the top level of a module are imported as properties of the module being imported
In a so-called program file, the variables defined and declared directly shelf are called global variables, and for a module, the variables defined in the top level are all called the properties of the module, and the classes, methods (functions) defined inside the module become similar to the properties that the module can be called.
Python program architecture
1, a Python program usually includes a top-level program files and other module files (0, one or more)
Top-level files: Contains the main control flow of the program
Module files: Provides a variety of functional components for top-level files or other modules
When the module is first imported (or overloaded), Python immediately executes the top-level program code of the module file (code that is not inside the function), and the code within the body of the function is not executed until the function is called.
When is the function executed?
Modules can also be imported into other modules, and import is a chain-type relationship,
Parameters available in Setup () in setup.py
Platforms: Platform List
License: License
Py_modules: A list of the names of each module, which may be in the root directory of the package (ModName) or in a sub-package directory (Subpkg1.modname)
Packages: List of each child package name
Broadly divided into two categories: metadata information and take care of the content list
Python setup. PY Sdist
You can specify a format for sdist--formats=
Zip:zip file
gztar:tar.gz file
batar:tar.bz2 file
Ztar:tar. Z file
Tar:tar file
Python setup. PY Ddist
You can specify a format for ddist--formats=
Zip:zip file
gztar:tar.gz file
Ztar:tar. Z file
Tar:tar file
RPM:RPM Package
Pkgtool:solaris Pkgtool
Wininst:window on the self-extracting zip format of the package
Msi:microsoft Installer
Bdist_dump
bdist_rpm
Bdist_wininst
Bdist_msi
How to get Help
Python setup.py--help
Python setup.py--help-commands: All commands that can be used. such as Build,install
Python setup.py command--help: Get help with specific commands
Python setup.py command--help-formats: Get the format supported by a particular command
Pip
1. Python modules and packages (0602)