1. py file automatically created global variables
Print (VARs ()) return value: {' __name__ ': ' __main__ ', ' __package__ ': None, ' __loader__ ': <_frozen_importlib_external. Sourcefileloader object at 0x0000025471756e10>, ' __cached__ ': None, ' __doc__ ': None, ' __file__ ': ' c:/users/john/ pycharmprojects/q1/day12/index.py ', ' __spec__ ': None, ' __builtins__ ': <module ' builtins ' (built-in);}
1.1 Common variables:
__doc__ #py文件的注释
__file__# own path
__package__# the package where the current. PY is located
__cached __#py Cache
__name__# display the name of the py file;
1.2 Infrequently used variables:
__LOADER__: System call
__spec__ system Call
__builtins__# #存放内置函数
2. Module
For a complex function, multiple functions may be required to complete (functions can also be in different. py files), and the Code collection consisting of N. py files is called a module.
Like functional programming and process-oriented programming, functional programming accomplishes a function, and other code is used to invoke it, providing reusability of code and coupling between the code.
Modules can be divided into three types:
- Custom modules:
- Third-party modules:
- Built-in modules: Call directly
3.
4. End
pyday10&11&12-Common modules: time|datetime|os|sys|pickle|json|xml, string formatting, py auto Global variables