OS module Introduction The OS module is a module used to access operating system functions in the Python standard library. The OS module provides a portable Method for operating system functions. The interface provided in the OS module can be used for cross-platform access. However, the interfaces in the OS module are not common to all platforms. Some interfaces rely on interfaces on specific platforms. The OS module provides a series of interfaces for accessing the operating system functions to facilitate the compilation of cross-platform applications. When using the OS module, if you need to obtain the system name, you can use the OS. name gets the name of the system that is thrown into this module. If it is on windows, 'nt 'is returned, and 'posix' is returned in Linux '. When using the OS module, if an exception occurs during use, the OS module will throw an OSError exception, indicating that the path name or file name is invalid, or the given path name or file name cannot be accessed, or the currently used system does not support it. In the OS module, you can use the OS. error exception defined by the OS module. OS. error is the alias of OSError. The portable OS module provides some Defined variables that can be supported across platforms. It is easy to write highly portable and strong code. OS. different sep platforms have different path Representation Methods. To facilitate code writing and increase portability, you can use OS. sep serves as the path separator. When Python interprets and executes code containing these variables, different separators are used for different systems. In windows, OS. sep is '\' and POSIX is '/'. OS. altsep is another file path separator that can be used in place. If the system supports other separators, you can use OS. altsep is used to use other types of delimiters supported by the system. If the system does not support the delimiters, the value is None. For example, in Windows, OS. altsep is '/'. OS. extsep: The separator between the file name and the file extension. It is '.' in Windows '.'. The delimiter in the OS. pathsep PATH environment variable, which is ':' In the POSIX system and ';' in Windows ';'. When OS. defpath uses the exec function family, if the PATH environment variable is not specified, the value in OS. defpath is used as the sub-process PATH value by default. OS. linesep has different terminologies at the end of the line in different systems. In Windows, it is '\ r \ n', OS. the value in linesep is the row Terminator supported by the system. OS. devnull: the path of the null Device on different systems. It is 'nul 'in Windows and'/dev/null' in POSIX '.