© 2021 osiyannoye-slovo.ru
This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see open , if you want to manipulate paths, see the os. For creating temporary files and directories see the tempfile module, and for high-level file and directory handling see the shutil module. The design of all built-in operating system dependent modules of Python is such that as long as the same functionality is available, it uses the same interface; for example, the function os. Extensions peculiar to a particular operating system are also available through the os module, but using them is of course a threat to portability. All functions accepting path or file names accept both bytes and string objects, and result in an object of the same type, if a path or file name is returned. All functions in this module raise OSError or subclasses thereof in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type, but are not accepted by the operating system. An alias for the built-in OSError exception. The name of the operating system dependent module imported. In Python, file names, command line arguments, and environment variables are represented using the string type. On some systems, decoding these strings to and from bytes is necessary before passing them to the operating system. Python uses the file system encoding to perform this conversion see sys. Changed in version 3. The file system encoding must guarantee to successfully decode all bytes below Availability : Unix. A mapping object representing the string environment. This mapping is captured the first time the os module is imported, typically during Python startup as part of processing site. Changes to the environment made after this time are not reflected in os. If the platform supports the putenv function, this mapping may be used to modify the environment as well as query the environment. On Unix, keys and values use sys.