> **Источник:** https://python-all.ru/3.0/library/allos.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# Службы операционной системы общего назначения

Модули, описанные в этой главе, предоставляют интерфейсы к возможностям операционной системы, доступным (почти) во всех ОС, таким как файлы и часы. Интерфейсы в основном смоделированы по образцу Unix- или C-интерфейсов, но они также доступны и в большинстве других систем. Вот обзор:

- [`os` – Различные интерфейсы операционной системы](https://python-all.ru/3.0/library/os.html)

  - [Параметры процесса](https://python-all.ru/3.0/library/os.html#process-parameters)
  - [Создание файловых объектов](https://python-all.ru/3.0/library/os.html#file-object-creation)
  - [Операции с файловыми дескрипторами](https://python-all.ru/3.0/library/os.html#file-descriptor-operations)
  - [Файлы и каталоги](https://python-all.ru/3.0/library/os.html#files-and-directories)
  - [Управление процессами](https://python-all.ru/3.0/library/os.html#process-management)
  - [Различная системная информация](https://python-all.ru/3.0/library/os.html#miscellaneous-system-information)
  - [Различные функции](https://python-all.ru/3.0/library/os.html#miscellaneous-functions)
- [`io` – Основные инструменты для работы с потоками](https://python-all.ru/3.0/library/io.html)

  - [Интерфейс модуля](https://python-all.ru/3.0/library/io.html#module-interface)
  - [Базовые классы ввода/вывода](https://python-all.ru/3.0/library/io.html#i-o-base-classes)
  - [Необработанный файловый ввод/вывод](https://python-all.ru/3.0/library/io.html#raw-file-i-o)
  - [Буферизированные потоки](https://python-all.ru/3.0/library/io.html#buffered-streams)
  - [Текстовый ввод/вывод](https://python-all.ru/3.0/library/io.html#text-i-o)
- [`time` – Доступ и преобразования времени](https://python-all.ru/3.0/library/time.html)
- [`optparse` – Более мощный парсер опций командной строки](https://python-all.ru/3.0/library/optparse.html)

  - [Фон](https://python-all.ru/3.0/library/optparse.html#background)

    - [Терминология](https://python-all.ru/3.0/library/optparse.html#terminology)
    - [Для чего нужны опции?](https://python-all.ru/3.0/library/optparse.html#what-are-options-for)
    - [Для чего нужны позиционные аргументы?](https://python-all.ru/3.0/library/optparse.html#what-are-positional-arguments-for)
  - [Учебное пособие](https://python-all.ru/3.0/library/optparse.html#tutorial)

    - [Понимание действий опций](https://python-all.ru/3.0/library/optparse.html#understanding-option-actions)
    - [Действие store](https://python-all.ru/3.0/library/optparse.html#the-store-action)
    - [Обработка булевых опций (флагов)](https://python-all.ru/3.0/library/optparse.html#handling-boolean-flag-options)
    - [Другие действия](https://python-all.ru/3.0/library/optparse.html#other-actions)
    - [Значения по умолчанию](https://python-all.ru/3.0/library/optparse.html#default-values)
    - [Генерация справки](https://python-all.ru/3.0/library/optparse.html#generating-help)
    - [Вывод строки версии](https://python-all.ru/3.0/library/optparse.html#printing-a-version-string)
    - [Как `optparse` обрабатывает ошибки](https://python-all.ru/3.0/library/optparse.html#how-optparse-handles-errors)
    - [Собираем всё вместе](https://python-all.ru/3.0/library/optparse.html#putting-it-all-together)
  - [Справочное руководство](https://python-all.ru/3.0/library/optparse.html#reference-guide)

    - [Создание парсера](https://python-all.ru/3.0/library/optparse.html#creating-the-parser)
    - [Наполнение парсера](https://python-all.ru/3.0/library/optparse.html#populating-the-parser)
    - [Определение параметров](https://python-all.ru/3.0/library/optparse.html#defining-options)
    - [Стандартные действия параметров](https://python-all.ru/3.0/library/optparse.html#standard-option-actions)
    - [Атрибуты параметров](https://python-all.ru/3.0/library/optparse.html#option-attributes)
    - [Стандартные типы параметров](https://python-all.ru/3.0/library/optparse.html#standard-option-types)
    - [Разбор аргументов](https://python-all.ru/3.0/library/optparse.html#parsing-arguments)
    - [Запросы и управление парсером параметров](https://python-all.ru/3.0/library/optparse.html#querying-and-manipulating-your-option-parser)
    - [Конфликты между параметрами](https://python-all.ru/3.0/library/optparse.html#conflicts-between-options)
    - [Очистка](https://python-all.ru/3.0/library/optparse.html#cleanup)
    - [Другие методы](https://python-all.ru/3.0/library/optparse.html#other-methods)
  - [Колбэки параметров](https://python-all.ru/3.0/library/optparse.html#option-callbacks)

    - [Определение параметра с колбэком](https://python-all.ru/3.0/library/optparse.html#defining-a-callback-option)
    - [Как вызываются колбэки](https://python-all.ru/3.0/library/optparse.html#how-callbacks-are-called)
    - [Возбуждение исключений в колбэке](https://python-all.ru/3.0/library/optparse.html#raising-errors-in-a-callback)
    - [Пример колбэка 1: простейший колбэк](https://python-all.ru/3.0/library/optparse.html#callback-example-1-trivial-callback)
    - [Пример колбэка 2: проверка порядка параметров](https://python-all.ru/3.0/library/optparse.html#callback-example-2-check-option-order)
    - [Пример колбэка 3: проверка порядка параметров (обобщённо)](https://python-all.ru/3.0/library/optparse.html#callback-example-3-check-option-order-generalized)
    - [Пример колбэка 4: проверка произвольного условия](https://python-all.ru/3.0/library/optparse.html#callback-example-4-check-arbitrary-condition)
    - [Пример колбэка 5: фиксированные аргументы](https://python-all.ru/3.0/library/optparse.html#callback-example-5-fixed-arguments)
    - [Пример колбэка 6: переменное число аргументов](https://python-all.ru/3.0/library/optparse.html#callback-example-6-variable-arguments)
  - [Расширение `optparse`](https://python-all.ru/3.0/library/optparse.html#extending-optparse)

    - [Добавление новых типов](https://python-all.ru/3.0/library/optparse.html#adding-new-types)
    - [Добавление новых действий](https://python-all.ru/3.0/library/optparse.html#adding-new-actions)
- [`getopt` – Парсер опций командной строки](https://python-all.ru/3.0/library/getopt.html)
- [`logging` – Средство логирования для Python](https://python-all.ru/3.0/library/logging.html)

  - [Руководство по логированию](https://python-all.ru/3.0/library/logging.html#logging-tutorial)

    - [Простые примеры](https://python-all.ru/3.0/library/logging.html#simple-examples)
    - [Логгеры](https://python-all.ru/3.0/library/logging.html#loggers)
    - [Обработчики](https://python-all.ru/3.0/library/logging.html#handlers)
    - [Форматировщики](https://python-all.ru/3.0/library/logging.html#formatters)
    - [Настройка логирования](https://python-all.ru/3.0/library/logging.html#configuring-logging)
    - [Настройка логирования для библиотеки](https://python-all.ru/3.0/library/logging.html#configuring-logging-for-a-library)
  - [Уровни журналирования](https://python-all.ru/3.0/library/logging.html#logging-levels)
  - [Полезные обработчики](https://python-all.ru/3.0/library/logging.html#module-logging.handlers)
  - [Функции уровня модуля](https://python-all.ru/3.0/library/logging.html#module-level-functions)
  - [Объекты Logger](https://python-all.ru/3.0/library/logging.html#logger-objects)
  - [Простой пример](https://python-all.ru/3.0/library/logging.html#basic-example)
  - [Логирование в несколько мест назначения](https://python-all.ru/3.0/library/logging.html#logging-to-multiple-destinations)
  - [Добавление контекстной информации в вывод логирования](https://python-all.ru/3.0/library/logging.html#adding-contextual-information-to-your-logging-output)
  - [Отправка и получение событий логирования по сети](https://python-all.ru/3.0/library/logging.html#sending-and-receiving-logging-events-across-a-network)
  - [Объекты-обработчики](https://python-all.ru/3.0/library/logging.html#handler-objects)

    - [StreamHandler](https://python-all.ru/3.0/library/logging.html#streamhandler)
    - [FileHandler](https://python-all.ru/3.0/library/logging.html#filehandler)
    - [NullHandler](https://python-all.ru/3.0/library/logging.html#nullhandler)
    - [WatchedFileHandler](https://python-all.ru/3.0/library/logging.html#watchedfilehandler)
    - [RotatingFileHandler](https://python-all.ru/3.0/library/logging.html#rotatingfilehandler)
    - [TimedRotatingFileHandler](https://python-all.ru/3.0/library/logging.html#timedrotatingfilehandler)
    - [Обработчик сокетов](https://python-all.ru/3.0/library/logging.html#sockethandler)
    - [Обработчик датаграмм](https://python-all.ru/3.0/library/logging.html#datagramhandler)
    - [Обработчик системного журнала](https://python-all.ru/3.0/library/logging.html#sysloghandler)
    - [Обработчик журнала событий NT](https://python-all.ru/3.0/library/logging.html#nteventloghandler)
    - [SMTP-обработчик](https://python-all.ru/3.0/library/logging.html#smtphandler)
    - [Обработчик памяти](https://python-all.ru/3.0/library/logging.html#memoryhandler)
    - [HTTP-обработчик](https://python-all.ru/3.0/library/logging.html#httphandler)
  - [Объекты-форматировщики](https://python-all.ru/3.0/library/logging.html#id1)
  - [Объекты-фильтры](https://python-all.ru/3.0/library/logging.html#filter-objects)
  - [Объекты LogRecord](https://python-all.ru/3.0/library/logging.html#logrecord-objects)
  - [Объекты LoggerAdapter](https://python-all.ru/3.0/library/logging.html#loggeradapter-objects)
  - [Потокобезопасность](https://python-all.ru/3.0/library/logging.html#thread-safety)
  - [Конфигурация](https://python-all.ru/3.0/library/logging.html#configuration)

    - [Функции конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-functions)
    - [Формат файла конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-file-format)
    - [Пример сервера конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-server-example)
  - [Дополнительные примеры](https://python-all.ru/3.0/library/logging.html#more-examples)

    - [Несколько обработчиков и форматировщиков](https://python-all.ru/3.0/library/logging.html#multiple-handlers-and-formatters)
    - [Использование логирования в нескольких модулях](https://python-all.ru/3.0/library/logging.html#using-logging-in-multiple-modules)
- [`getpass` – Переносимый ввод пароля](https://python-all.ru/3.0/library/getpass.html)
- [`curses` – Управление терминалом для символьных дисплеев](https://python-all.ru/3.0/library/curses.html)

  - [Функции](https://python-all.ru/3.0/library/curses.html#functions)
  - [Объекты окон](https://python-all.ru/3.0/library/curses.html#window-objects)
  - [Константы](https://python-all.ru/3.0/library/curses.html#constants)
- [`curses.textpad` – Виджет ввода текста для программ curses](https://python-all.ru/3.0/library/curses.html#module-curses.textpad)

  - [Объекты Textbox](https://python-all.ru/3.0/library/curses.html#textbox-objects)
- [`curses.wrapper` – Обработчик терминала для программ curses](https://python-all.ru/3.0/library/curses.html#module-curses.wrapper)
- [`curses.ascii` – Утилиты для символов ASCII](https://python-all.ru/3.0/library/curses.ascii.html)
- [`curses.panel` – Расширение стека панелей для curses.](https://python-all.ru/3.0/library/curses.panel.html)

  - [Функции](https://python-all.ru/3.0/library/curses.panel.html#functions)
  - [Объекты панелей](https://python-all.ru/3.0/library/curses.panel.html#panel-objects)
- [`platform` – Доступ к идентификационным данным базовой платформы.](https://python-all.ru/3.0/library/platform.html)

  - [Кроссплатформенные](https://python-all.ru/3.0/library/platform.html#cross-platform)
  - [Платформа Java](https://python-all.ru/3.0/library/platform.html#java-platform)
  - [Платформа Windows](https://python-all.ru/3.0/library/platform.html#windows-platform)

    - [Специфично для Win95/98](https://python-all.ru/3.0/library/platform.html#win95-98-specific)
  - [Платформа Mac OS](https://python-all.ru/3.0/library/platform.html#mac-os-platform)
  - [Платформы Unix](https://python-all.ru/3.0/library/platform.html#unix-platforms)
- [`errno` – Стандартные системные символы errno](https://python-all.ru/3.0/library/errno.html)
- [`ctypes` – Библиотека внешних функций для Python.](https://python-all.ru/3.0/library/ctypes.html)

  - [Руководство по ctypes](https://python-all.ru/3.0/library/ctypes.html#ctypes-tutorial)

    - [Загрузка библиотек динамической компоновки](https://python-all.ru/3.0/library/ctypes.html#loading-dynamic-link-libraries)
    - [Доступ к функциям из загруженных DLL](https://python-all.ru/3.0/library/ctypes.html#accessing-functions-from-loaded-dlls)
    - [Вызов функций](https://python-all.ru/3.0/library/ctypes.html#calling-functions)
    - [Базовые типы данных](https://python-all.ru/3.0/library/ctypes.html#fundamental-data-types)
    - [Вызов функций (продолжение)](https://python-all.ru/3.0/library/ctypes.html#calling-functions-continued)
    - [Вызов функций с собственными пользовательскими типами данных](https://python-all.ru/3.0/library/ctypes.html#calling-functions-with-your-own-custom-data-types)
    - [Указание требуемых типов аргументов (прототипы функций)](https://python-all.ru/3.0/library/ctypes.html#specifying-the-required-argument-types-function-prototypes)
    - [Типы возвращаемых значений](https://python-all.ru/3.0/library/ctypes.html#return-types)
    - [Передача указателей (или передача параметров по ссылке)](https://python-all.ru/3.0/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference)
    - [Структуры и объединения](https://python-all.ru/3.0/library/ctypes.html#structures-and-unions)
    - [Выравнивание структур/объединений и порядок байтов](https://python-all.ru/3.0/library/ctypes.html#structure-union-alignment-and-byte-order)
    - [Битовые поля в структурах и объединениях](https://python-all.ru/3.0/library/ctypes.html#bit-fields-in-structures-and-unions)
    - [Массивы](https://python-all.ru/3.0/library/ctypes.html#arrays)
    - [Указатели](https://python-all.ru/3.0/library/ctypes.html#pointers)
    - [Преобразования типов](https://python-all.ru/3.0/library/ctypes.html#type-conversions)
    - [Неполные типы](https://python-all.ru/3.0/library/ctypes.html#incomplete-types)
    - [Функции обратного вызова](https://python-all.ru/3.0/library/ctypes.html#callback-functions)
    - [Доступ к значениям, экспортируемым из DLL](https://python-all.ru/3.0/library/ctypes.html#accessing-values-exported-from-dlls)
    - [Неожиданности](https://python-all.ru/3.0/library/ctypes.html#surprises)
    - [Типы данных переменного размера](https://python-all.ru/3.0/library/ctypes.html#variable-sized-data-types)
  - [Справочник по ctypes](https://python-all.ru/3.0/library/ctypes.html#ctypes-reference)

    - [Поиск общих библиотек](https://python-all.ru/3.0/library/ctypes.html#finding-shared-libraries)
    - [Загрузка общих библиотек](https://python-all.ru/3.0/library/ctypes.html#loading-shared-libraries)
    - [Внешние функции](https://python-all.ru/3.0/library/ctypes.html#foreign-functions)
    - [Прототипы функций](https://python-all.ru/3.0/library/ctypes.html#function-prototypes)
    - [Вспомогательные функции](https://python-all.ru/3.0/library/ctypes.html#utility-functions)
    - [Типы данных](https://python-all.ru/3.0/library/ctypes.html#data-types)
    - [Базовые типы данных](https://python-all.ru/3.0/library/ctypes.html#id1)
    - [Структурированные типы данных](https://python-all.ru/3.0/library/ctypes.html#structured-data-types)
    - [Массивы и указатели](https://python-all.ru/3.0/library/ctypes.html#arrays-and-pointers)
