python -> sys module

table of Contents

A, sys module

Responsible for interacting with the python interpreter program sys module, it provides a range of functions and variables to control when running python environment.

It is the longest with the previous two months

method Detailed
sys.argv List command line arguments, the first path element of the program itself, the received parameters (while running with a valid executable file cmd)
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

Guess you like

Origin www.cnblogs.com/SkyOceanchen/p/11402472.html