SyS module
- Responsible for interacting with the python interpreter program sys module, it provides a number of functions and variables to control when running python environment.
Important to remember:
print (sys.path) returned in the search path to the module, using the value of environment variable initialization PYTHONPATH
- print (sys.argv) receive parameters (only effective when operated with cmd executable file), the first element is the path to the program itself
print (sys.modules) Returns the field of system implementation module, key module name, value module is
method | Detailed |
---|---|
sys.argv | Command line parameters List, the first element is the path to the program itself |
sys.modules.keys() | Returns a list of all the imported modules |
sys.exc_info() | For more information on obtaining an exception currently being handled exception class, exc_type, exc_value, exc_traceback currently being processed |
sys.exit(n) | Exit the program, when the normal exit exit (0) |
sys.hexversion | Gets the version of Python interpreter value, hexadecimal formats such as: 0x020403F0 |
sys.version | Version Get Python interpreter |
sys.maxint | The maximum value of Int |
sys.maxunicode | The maximum value of the Unicode |
sys.modules | Return system imported module field, key is the module name, value module is |
sys.path | Back module search path, using initialization value of the environment variable PYTHONPATH |
sys.platform | Returns the name of the operating system platform |
sys.stdout | Standard output |
sys.stdin | Standard Input |
sys.stderr | Error output |
sys.exc_clear() | To clear the current thread that appears in the current or most recent error message |
sys.exec_prefix | Returns the platform-independent file installation location python |
sys.byteorder | Local rule pointer byte, the value of the platform is big-endian 'big', the value of little-endian platform is 'little' |
sys.copyright | Record python copyright-related stuff |
sys.api_version | API versions of C interpreter |