allos.md
1> **Источник:** https://python-all.ru/3.11/library/allos.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Службы операционной системы общего назначения89Модули, описанные в этой главе, предоставляют интерфейсы к возможностям операционной системы, доступным (почти) во всех ОС, таким как файлы и часы. Интерфейсы в основном смоделированы по образцу Unix- или C-интерфейсов, но они также доступны и в большинстве других систем. Вот обзор:1011- [`os` – различные интерфейсы операционной системы](https://python-all.ru/3.11/library/os.html)1213 - [Имена файлов, аргументы командной строки и переменные окружения](https://python-all.ru/3.11/library/os.html#file-names-command-line-arguments-and-environment-variables)14 - [Режим UTF-8 в Python](https://python-all.ru/3.11/library/os.html#python-utf-8-mode)15 - [Параметры процесса](https://python-all.ru/3.11/library/os.html#process-parameters)16 - [Создание файловых объектов](https://python-all.ru/3.11/library/os.html#file-object-creation)17 - [Операции с файловыми дескрипторами](https://python-all.ru/3.11/library/os.html#file-descriptor-operations)1819 - [Определение размера терминала](https://python-all.ru/3.11/library/os.html#querying-the-size-of-a-terminal)20 - [Наследование файловых дескрипторов](https://python-all.ru/3.11/library/os.html#inheritance-of-file-descriptors)21 - [Файлы и каталоги](https://python-all.ru/3.11/library/os.html#files-and-directories)2223 - [Расширенные атрибуты Linux](https://python-all.ru/3.11/library/os.html#linux-extended-attributes)24 - [Управление процессами](https://python-all.ru/3.11/library/os.html#process-management)25 - [Интерфейс к планировщику](https://python-all.ru/3.11/library/os.html#interface-to-the-scheduler)26 - [Различная системная информация](https://python-all.ru/3.11/library/os.html#miscellaneous-system-information)27 - [Случайные числа](https://python-all.ru/3.11/library/os.html#random-numbers)28- [`io` – Основные инструменты для работы с потоками данных](https://python-all.ru/3.11/library/io.html)2930 - [Обзор](https://python-all.ru/3.11/library/io.html#overview)3132 - [Текстовый ввод/вывод](https://python-all.ru/3.11/library/io.html#text-i-o)33 - [Двоичный ввод/вывод](https://python-all.ru/3.11/library/io.html#binary-i-o)34 - [Необработанный ввод/вывод](https://python-all.ru/3.11/library/io.html#raw-i-o)35 - [Кодировка текста](https://python-all.ru/3.11/library/io.html#text-encoding)3637 - [Добровольное предупреждение о кодировке](https://python-all.ru/3.11/library/io.html#opt-in-encodingwarning)38 - [Интерфейс модуля высокого уровня](https://python-all.ru/3.11/library/io.html#high-level-module-interface)39 - [Иерархия классов](https://python-all.ru/3.11/library/io.html#class-hierarchy)4041 - [Базовые классы ввода/вывода](https://python-all.ru/3.11/library/io.html#i-o-base-classes)42 - [Необработанный файловый ввод/вывод](https://python-all.ru/3.11/library/io.html#raw-file-i-o)43 - [Буферизированные потоки](https://python-all.ru/3.11/library/io.html#buffered-streams)44 - [Текстовый ввод/вывод](https://python-all.ru/3.11/library/io.html#id1)45 - [Производительность](https://python-all.ru/3.11/library/io.html#performance)4647 - [Двоичный ввод/вывод](https://python-all.ru/3.11/library/io.html#id2)48 - [Текстовый ввод/вывод](https://python-all.ru/3.11/library/io.html#id3)49 - [Многопоточность](https://python-all.ru/3.11/library/io.html#multi-threading)50 - [Реентерабельность](https://python-all.ru/3.11/library/io.html#reentrancy)51- [`time` – Доступ ко времени и преобразования](https://python-all.ru/3.11/library/time.html)5253 - [Функции](https://python-all.ru/3.11/library/time.html#functions)54 - [Константы идентификаторов часов](https://python-all.ru/3.11/library/time.html#clock-id-constants)55 - [Константы часовых поясов](https://python-all.ru/3.11/library/time.html#timezone-constants)56- [`argparse` – Парсер параметров командной строки, аргументов и подкоманд](https://python-all.ru/3.11/library/argparse.html)5758 - [Основная функциональность](https://python-all.ru/3.11/library/argparse.html#core-functionality)59 - [Быстрые ссылки для add\_argument()](https://python-all.ru/3.11/library/argparse.html#quick-links-for-add-argument)60 - [Пример](https://python-all.ru/3.11/library/argparse.html#example)6162 - [Создание парсера](https://python-all.ru/3.11/library/argparse.html#creating-a-parser)63 - [Добавление аргументов](https://python-all.ru/3.11/library/argparse.html#adding-arguments)64 - [Разбор аргументов](https://python-all.ru/3.11/library/argparse.html#parsing-arguments)65 - [Объекты ArgumentParser](https://python-all.ru/3.11/library/argparse.html#argumentparser-objects)6667 - [prog](https://python-all.ru/3.11/library/argparse.html#prog)68 - [usage](https://python-all.ru/3.11/library/argparse.html#usage)69 - [description](https://python-all.ru/3.11/library/argparse.html#description)70 - [epilog](https://python-all.ru/3.11/library/argparse.html#epilog)71 - [parents](https://python-all.ru/3.11/library/argparse.html#parents)72 - [formatter\_class](https://python-all.ru/3.11/library/argparse.html#formatter-class)73 - [prefix\_chars](https://python-all.ru/3.11/library/argparse.html#prefix-chars)74 - [fromfile\_prefix\_chars](https://python-all.ru/3.11/library/argparse.html#fromfile-prefix-chars)75 - [argument\_default](https://python-all.ru/3.11/library/argparse.html#argument-default)76 - [allow\_abbrev](https://python-all.ru/3.11/library/argparse.html#allow-abbrev)77 - [conflict\_handler](https://python-all.ru/3.11/library/argparse.html#conflict-handler)78 - [add\_help](https://python-all.ru/3.11/library/argparse.html#add-help)79 - [exit\_on\_error](https://python-all.ru/3.11/library/argparse.html#exit-on-error)80 - [Метод add\_argument()](https://python-all.ru/3.11/library/argparse.html#the-add-argument-method)8182 - [name или flags](https://python-all.ru/3.11/library/argparse.html#name-or-flags)83 - [action](https://python-all.ru/3.11/library/argparse.html#action)84 - [nargs](https://python-all.ru/3.11/library/argparse.html#nargs)85 - [const](https://python-all.ru/3.11/library/argparse.html#const)86 - [default](https://python-all.ru/3.11/library/argparse.html#default)87 - [тип](https://python-all.ru/3.11/library/argparse.html#type)88 - [choices](https://python-all.ru/3.11/library/argparse.html#choices)89 - [required](https://python-all.ru/3.11/library/argparse.html#required)90 - [help](https://python-all.ru/3.11/library/argparse.html#help)91 - [metavar](https://python-all.ru/3.11/library/argparse.html#metavar)92 - [dest](https://python-all.ru/3.11/library/argparse.html#dest)93 - [Классы Action](https://python-all.ru/3.11/library/argparse.html#action-classes)94 - [Метод parse\_args()](https://python-all.ru/3.11/library/argparse.html#the-parse-args-method)9596 - [Синтаксис значений опций](https://python-all.ru/3.11/library/argparse.html#option-value-syntax)97 - [Недопустимые аргументы](https://python-all.ru/3.11/library/argparse.html#invalid-arguments)98 - [Аргументы, содержащие `-`](https://python-all.ru/3.11/library/argparse.html#arguments-containing)99 - [Сокращения аргументов (сопоставление по префиксу)](https://python-all.ru/3.11/library/argparse.html#argument-abbreviations-prefix-matching)100 - [За пределами `sys.argv`](https://python-all.ru/3.11/library/argparse.html#beyond-sys-argv)101 - [Объект Namespace](https://python-all.ru/3.11/library/argparse.html#the-namespace-object)102 - [Прочие утилиты](https://python-all.ru/3.11/library/argparse.html#other-utilities)103104 - [Подкоманды](https://python-all.ru/3.11/library/argparse.html#sub-commands)105 - [Объекты FileType](https://python-all.ru/3.11/library/argparse.html#filetype-objects)106 - [Группы аргументов](https://python-all.ru/3.11/library/argparse.html#argument-groups)107 - [Взаимное исключение](https://python-all.ru/3.11/library/argparse.html#mutual-exclusion)108 - [Значения по умолчанию парсера](https://python-all.ru/3.11/library/argparse.html#parser-defaults)109 - [Вывод справки](https://python-all.ru/3.11/library/argparse.html#printing-help)110 - [Частичный разбор](https://python-all.ru/3.11/library/argparse.html#partial-parsing)111 - [Настройка разбора файлов](https://python-all.ru/3.11/library/argparse.html#customizing-file-parsing)112 - [Методы завершения](https://python-all.ru/3.11/library/argparse.html#exiting-methods)113 - [Смешанный разбор](https://python-all.ru/3.11/library/argparse.html#intermixed-parsing)114 - [Обновление кода optparse](https://python-all.ru/3.11/library/argparse.html#upgrading-optparse-code)115 - [Исключения](https://python-all.ru/3.11/library/argparse.html#exceptions)116- [`getopt` – Парсер параметров командной строки в стиле C](https://python-all.ru/3.11/library/getopt.html)117- [`logging` – Средство журналирования для Python](https://python-all.ru/3.11/library/logging.html)118119 - [Объекты Logger](https://python-all.ru/3.11/library/logging.html#logger-objects)120 - [Уровни журналирования](https://python-all.ru/3.11/library/logging.html#logging-levels)121 - [Объекты-обработчики](https://python-all.ru/3.11/library/logging.html#handler-objects)122 - [Объекты-форматировщики](https://python-all.ru/3.11/library/logging.html#formatter-objects)123 - [Объекты-фильтры](https://python-all.ru/3.11/library/logging.html#filter-objects)124 - [Объекты LogRecord](https://python-all.ru/3.11/library/logging.html#logrecord-objects)125 - [Атрибуты LogRecord](https://python-all.ru/3.11/library/logging.html#logrecord-attributes)126 - [Объекты LoggerAdapter](https://python-all.ru/3.11/library/logging.html#loggeradapter-objects)127 - [Потокобезопасность](https://python-all.ru/3.11/library/logging.html#thread-safety)128 - [Функции уровня модуля](https://python-all.ru/3.11/library/logging.html#module-level-functions)129 - [Атрибуты уровня модуля](https://python-all.ru/3.11/library/logging.html#module-level-attributes)130 - [Интеграция с модулем warnings](https://python-all.ru/3.11/library/logging.html#integration-with-the-warnings-module)131- [`logging.config` – Конфигурация логирования](https://python-all.ru/3.11/library/logging.config.html)132133 - [Функции конфигурации](https://python-all.ru/3.11/library/logging.config.html#configuration-functions)134 - [Вопросы безопасности](https://python-all.ru/3.11/library/logging.config.html#security-considerations)135 - [Схема конфигурационного словаря](https://python-all.ru/3.11/library/logging.config.html#configuration-dictionary-schema)136137 - [Подробности схемы словаря](https://python-all.ru/3.11/library/logging.config.html#dictionary-schema-details)138 - [Инкрементальная конфигурация](https://python-all.ru/3.11/library/logging.config.html#incremental-configuration)139 - [Соединения объектов](https://python-all.ru/3.11/library/logging.config.html#object-connections)140 - [Пользовательские объекты](https://python-all.ru/3.11/library/logging.config.html#user-defined-objects)141 - [Порядок конфигурации обработчиков](https://python-all.ru/3.11/library/logging.config.html#handler-configuration-order)142 - [Доступ к внешним объектам](https://python-all.ru/3.11/library/logging.config.html#access-to-external-objects)143 - [Доступ к внутренним объектам](https://python-all.ru/3.11/library/logging.config.html#access-to-internal-objects)144 - [Разрешение импорта и пользовательские импортеры](https://python-all.ru/3.11/library/logging.config.html#import-resolution-and-custom-importers)145 - [Формат файла конфигурации](https://python-all.ru/3.11/library/logging.config.html#configuration-file-format)146- [`logging.handlers` – Обработчики логирования](https://python-all.ru/3.11/library/logging.handlers.html)147148 - [StreamHandler](https://python-all.ru/3.11/library/logging.handlers.html#streamhandler)149 - [FileHandler](https://python-all.ru/3.11/library/logging.handlers.html#filehandler)150 - [NullHandler](https://python-all.ru/3.11/library/logging.handlers.html#nullhandler)151 - [WatchedFileHandler](https://python-all.ru/3.11/library/logging.handlers.html#watchedfilehandler)152 - [BaseRotatingHandler](https://python-all.ru/3.11/library/logging.handlers.html#baserotatinghandler)153 - [RotatingFileHandler](https://python-all.ru/3.11/library/logging.handlers.html#rotatingfilehandler)154 - [TimedRotatingFileHandler](https://python-all.ru/3.11/library/logging.handlers.html#timedrotatingfilehandler)155 - [Обработчик сокетов](https://python-all.ru/3.11/library/logging.handlers.html#sockethandler)156 - [Обработчик датаграмм](https://python-all.ru/3.11/library/logging.handlers.html#datagramhandler)157 - [Обработчик системного журнала](https://python-all.ru/3.11/library/logging.handlers.html#sysloghandler)158 - [Обработчик журнала событий NT](https://python-all.ru/3.11/library/logging.handlers.html#nteventloghandler)159 - [SMTP-обработчик](https://python-all.ru/3.11/library/logging.handlers.html#smtphandler)160 - [Обработчик памяти](https://python-all.ru/3.11/library/logging.handlers.html#memoryhandler)161 - [HTTP-обработчик](https://python-all.ru/3.11/library/logging.handlers.html#httphandler)162 - [Обработчик очереди](https://python-all.ru/3.11/library/logging.handlers.html#queuehandler)163 - [Прослушиватель очереди](https://python-all.ru/3.11/library/logging.handlers.html#queuelistener)164- [`getpass` – Переносимый ввод пароля](https://python-all.ru/3.11/library/getpass.html)165- [`curses` – Управление терминалом для символьных дисплеев](https://python-all.ru/3.11/library/curses.html)166167 - [Функции](https://python-all.ru/3.11/library/curses.html#functions)168 - [Объекты окон](https://python-all.ru/3.11/library/curses.html#window-objects)169 - [Константы](https://python-all.ru/3.11/library/curses.html#constants)170- [`curses.textpad` – виджет ввода текста для программ curses](https://python-all.ru/3.11/library/curses.html#module-curses.textpad)171172 - [Объекты Textbox](https://python-all.ru/3.11/library/curses.html#textbox-objects)173- [`curses.ascii` – утилиты для работы с ASCII-символами](https://python-all.ru/3.11/library/curses.ascii.html)174- [`curses.panel` – расширение стека панелей для curses](https://python-all.ru/3.11/library/curses.panel.html)175176 - [Функции](https://python-all.ru/3.11/library/curses.panel.html#functions)177 - [Объекты панелей](https://python-all.ru/3.11/library/curses.panel.html#panel-objects)178- [`platform` – Доступ к идентифицирующим данным базовой платформы](https://python-all.ru/3.11/library/platform.html)179180 - [Кроссплатформенные](https://python-all.ru/3.11/library/platform.html#cross-platform)181 - [Платформа Java](https://python-all.ru/3.11/library/platform.html#java-platform)182 - [Платформа Windows](https://python-all.ru/3.11/library/platform.html#windows-platform)183 - [Платформа macOS](https://python-all.ru/3.11/library/platform.html#macos-platform)184 - [Платформы Unix](https://python-all.ru/3.11/library/platform.html#unix-platforms)185 - [Платформы Linux](https://python-all.ru/3.11/library/platform.html#linux-platforms)186- [`errno` – Стандартные системные символы errno](https://python-all.ru/3.11/library/errno.html)187- [`ctypes` – Библиотека внешних функций для Python](https://python-all.ru/3.11/library/ctypes.html)188189 - [Руководство по ctypes](https://python-all.ru/3.11/library/ctypes.html#ctypes-tutorial)190191 - [Загрузка библиотек динамической компоновки](https://python-all.ru/3.11/library/ctypes.html#loading-dynamic-link-libraries)192 - [Доступ к функциям из загруженных DLL](https://python-all.ru/3.11/library/ctypes.html#accessing-functions-from-loaded-dlls)193 - [Вызов функций](https://python-all.ru/3.11/library/ctypes.html#calling-functions)194 - [Базовые типы данных](https://python-all.ru/3.11/library/ctypes.html#fundamental-data-types)195 - [Вызов функций (продолжение)](https://python-all.ru/3.11/library/ctypes.html#calling-functions-continued)196 - [Вызов функций с переменным числом аргументов](https://python-all.ru/3.11/library/ctypes.html#calling-variadic-functions)197 - [Вызов функций с собственными пользовательскими типами данных](https://python-all.ru/3.11/library/ctypes.html#calling-functions-with-your-own-custom-data-types)198 - [Указание требуемых типов аргументов (прототипы функций)](https://python-all.ru/3.11/library/ctypes.html#specifying-the-required-argument-types-function-prototypes)199 - [Типы возвращаемых значений](https://python-all.ru/3.11/library/ctypes.html#return-types)200 - [Передача указателей (или передача параметров по ссылке)](https://python-all.ru/3.11/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference)201 - [Структуры и объединения](https://python-all.ru/3.11/library/ctypes.html#structures-and-unions)202 - [Выравнивание структур/объединений и порядок байтов](https://python-all.ru/3.11/library/ctypes.html#structure-union-alignment-and-byte-order)203 - [Битовые поля в структурах и объединениях](https://python-all.ru/3.11/library/ctypes.html#bit-fields-in-structures-and-unions)204 - [Массивы](https://python-all.ru/3.11/library/ctypes.html#arrays)205 - [Указатели](https://python-all.ru/3.11/library/ctypes.html#pointers)206 - [Преобразования типов](https://python-all.ru/3.11/library/ctypes.html#type-conversions)207 - [Неполные типы](https://python-all.ru/3.11/library/ctypes.html#incomplete-types)208 - [Функции обратного вызова](https://python-all.ru/3.11/library/ctypes.html#callback-functions)209 - [Доступ к значениям, экспортируемым из DLL](https://python-all.ru/3.11/library/ctypes.html#accessing-values-exported-from-dlls)210 - [Неожиданности](https://python-all.ru/3.11/library/ctypes.html#surprises)211 - [Типы данных переменного размера](https://python-all.ru/3.11/library/ctypes.html#variable-sized-data-types)212 - [Справочник по ctypes](https://python-all.ru/3.11/library/ctypes.html#ctypes-reference)213214 - [Поиск общих библиотек](https://python-all.ru/3.11/library/ctypes.html#finding-shared-libraries)215 - [Загрузка общих библиотек](https://python-all.ru/3.11/library/ctypes.html#loading-shared-libraries)216 - [Внешние функции](https://python-all.ru/3.11/library/ctypes.html#foreign-functions)217 - [Прототипы функций](https://python-all.ru/3.11/library/ctypes.html#function-prototypes)218 - [Вспомогательные функции](https://python-all.ru/3.11/library/ctypes.html#utility-functions)219 - [Типы данных](https://python-all.ru/3.11/library/ctypes.html#data-types)220 - [Базовые типы данных](https://python-all.ru/3.11/library/ctypes.html#ctypes-fundamental-data-types-2)221 - [Структурированные типы данных](https://python-all.ru/3.11/library/ctypes.html#structured-data-types)222 - [Массивы и указатели](https://python-all.ru/3.11/library/ctypes.html#arrays-and-pointers)223