Документация Python неофициальный перевод

allos.md

182 строк · 19.0 КБ · обычная страница · сырой текст · скачать

1> **Источник:** https://python-all.ru/3.0/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.0/library/os.html)1213  - [Параметры процесса](https://python-all.ru/3.0/library/os.html#process-parameters)14  - [Создание файловых объектов](https://python-all.ru/3.0/library/os.html#file-object-creation)15  - [Операции с файловыми дескрипторами](https://python-all.ru/3.0/library/os.html#file-descriptor-operations)16  - [Файлы и каталоги](https://python-all.ru/3.0/library/os.html#files-and-directories)17  - [Управление процессами](https://python-all.ru/3.0/library/os.html#process-management)18  - [Различная системная информация](https://python-all.ru/3.0/library/os.html#miscellaneous-system-information)19  - [Различные функции](https://python-all.ru/3.0/library/os.html#miscellaneous-functions)20- [`io` – Основные инструменты для работы с потоками](https://python-all.ru/3.0/library/io.html)2122  - [Интерфейс модуля](https://python-all.ru/3.0/library/io.html#module-interface)23  - [Базовые классы ввода/вывода](https://python-all.ru/3.0/library/io.html#i-o-base-classes)24  - [Необработанный файловый ввод/вывод](https://python-all.ru/3.0/library/io.html#raw-file-i-o)25  - [Буферизированные потоки](https://python-all.ru/3.0/library/io.html#buffered-streams)26  - [Текстовый ввод/вывод](https://python-all.ru/3.0/library/io.html#text-i-o)27- [`time` – Доступ и преобразования времени](https://python-all.ru/3.0/library/time.html)28- [`optparse` – Более мощный парсер опций командной строки](https://python-all.ru/3.0/library/optparse.html)2930  - [Фон](https://python-all.ru/3.0/library/optparse.html#background)3132    - [Терминология](https://python-all.ru/3.0/library/optparse.html#terminology)33    - [Для чего нужны опции?](https://python-all.ru/3.0/library/optparse.html#what-are-options-for)34    - [Для чего нужны позиционные аргументы?](https://python-all.ru/3.0/library/optparse.html#what-are-positional-arguments-for)35  - [Учебное пособие](https://python-all.ru/3.0/library/optparse.html#tutorial)3637    - [Понимание действий опций](https://python-all.ru/3.0/library/optparse.html#understanding-option-actions)38    - [Действие store](https://python-all.ru/3.0/library/optparse.html#the-store-action)39    - [Обработка булевых опций (флагов)](https://python-all.ru/3.0/library/optparse.html#handling-boolean-flag-options)40    - [Другие действия](https://python-all.ru/3.0/library/optparse.html#other-actions)41    - [Значения по умолчанию](https://python-all.ru/3.0/library/optparse.html#default-values)42    - [Генерация справки](https://python-all.ru/3.0/library/optparse.html#generating-help)43    - [Вывод строки версии](https://python-all.ru/3.0/library/optparse.html#printing-a-version-string)44    - [Как `optparse` обрабатывает ошибки](https://python-all.ru/3.0/library/optparse.html#how-optparse-handles-errors)45    - [Собираем всё вместе](https://python-all.ru/3.0/library/optparse.html#putting-it-all-together)46  - [Справочное руководство](https://python-all.ru/3.0/library/optparse.html#reference-guide)4748    - [Создание парсера](https://python-all.ru/3.0/library/optparse.html#creating-the-parser)49    - [Наполнение парсера](https://python-all.ru/3.0/library/optparse.html#populating-the-parser)50    - [Определение параметров](https://python-all.ru/3.0/library/optparse.html#defining-options)51    - [Стандартные действия параметров](https://python-all.ru/3.0/library/optparse.html#standard-option-actions)52    - [Атрибуты параметров](https://python-all.ru/3.0/library/optparse.html#option-attributes)53    - [Стандартные типы параметров](https://python-all.ru/3.0/library/optparse.html#standard-option-types)54    - [Разбор аргументов](https://python-all.ru/3.0/library/optparse.html#parsing-arguments)55    - [Запросы и управление парсером параметров](https://python-all.ru/3.0/library/optparse.html#querying-and-manipulating-your-option-parser)56    - [Конфликты между параметрами](https://python-all.ru/3.0/library/optparse.html#conflicts-between-options)57    - [Очистка](https://python-all.ru/3.0/library/optparse.html#cleanup)58    - [Другие методы](https://python-all.ru/3.0/library/optparse.html#other-methods)59  - [Колбэки параметров](https://python-all.ru/3.0/library/optparse.html#option-callbacks)6061    - [Определение параметра с колбэком](https://python-all.ru/3.0/library/optparse.html#defining-a-callback-option)62    - [Как вызываются колбэки](https://python-all.ru/3.0/library/optparse.html#how-callbacks-are-called)63    - [Возбуждение исключений в колбэке](https://python-all.ru/3.0/library/optparse.html#raising-errors-in-a-callback)64    - [Пример колбэка 1: простейший колбэк](https://python-all.ru/3.0/library/optparse.html#callback-example-1-trivial-callback)65    - [Пример колбэка 2: проверка порядка параметров](https://python-all.ru/3.0/library/optparse.html#callback-example-2-check-option-order)66    - [Пример колбэка 3: проверка порядка параметров (обобщённо)](https://python-all.ru/3.0/library/optparse.html#callback-example-3-check-option-order-generalized)67    - [Пример колбэка 4: проверка произвольного условия](https://python-all.ru/3.0/library/optparse.html#callback-example-4-check-arbitrary-condition)68    - [Пример колбэка 5: фиксированные аргументы](https://python-all.ru/3.0/library/optparse.html#callback-example-5-fixed-arguments)69    - [Пример колбэка 6: переменное число аргументов](https://python-all.ru/3.0/library/optparse.html#callback-example-6-variable-arguments)70  - [Расширение `optparse`](https://python-all.ru/3.0/library/optparse.html#extending-optparse)7172    - [Добавление новых типов](https://python-all.ru/3.0/library/optparse.html#adding-new-types)73    - [Добавление новых действий](https://python-all.ru/3.0/library/optparse.html#adding-new-actions)74- [`getopt` – Парсер опций командной строки](https://python-all.ru/3.0/library/getopt.html)75- [`logging` – Средство логирования для Python](https://python-all.ru/3.0/library/logging.html)7677  - [Руководство по логированию](https://python-all.ru/3.0/library/logging.html#logging-tutorial)7879    - [Простые примеры](https://python-all.ru/3.0/library/logging.html#simple-examples)80    - [Логгеры](https://python-all.ru/3.0/library/logging.html#loggers)81    - [Обработчики](https://python-all.ru/3.0/library/logging.html#handlers)82    - [Форматировщики](https://python-all.ru/3.0/library/logging.html#formatters)83    - [Настройка логирования](https://python-all.ru/3.0/library/logging.html#configuring-logging)84    - [Настройка логирования для библиотеки](https://python-all.ru/3.0/library/logging.html#configuring-logging-for-a-library)85  - [Уровни журналирования](https://python-all.ru/3.0/library/logging.html#logging-levels)86  - [Полезные обработчики](https://python-all.ru/3.0/library/logging.html#module-logging.handlers)87  - [Функции уровня модуля](https://python-all.ru/3.0/library/logging.html#module-level-functions)88  - [Объекты Logger](https://python-all.ru/3.0/library/logging.html#logger-objects)89  - [Простой пример](https://python-all.ru/3.0/library/logging.html#basic-example)90  - [Логирование в несколько мест назначения](https://python-all.ru/3.0/library/logging.html#logging-to-multiple-destinations)91  - [Добавление контекстной информации в вывод логирования](https://python-all.ru/3.0/library/logging.html#adding-contextual-information-to-your-logging-output)92  - [Отправка и получение событий логирования по сети](https://python-all.ru/3.0/library/logging.html#sending-and-receiving-logging-events-across-a-network)93  - [Объекты-обработчики](https://python-all.ru/3.0/library/logging.html#handler-objects)9495    - [StreamHandler](https://python-all.ru/3.0/library/logging.html#streamhandler)96    - [FileHandler](https://python-all.ru/3.0/library/logging.html#filehandler)97    - [NullHandler](https://python-all.ru/3.0/library/logging.html#nullhandler)98    - [WatchedFileHandler](https://python-all.ru/3.0/library/logging.html#watchedfilehandler)99    - [RotatingFileHandler](https://python-all.ru/3.0/library/logging.html#rotatingfilehandler)100    - [TimedRotatingFileHandler](https://python-all.ru/3.0/library/logging.html#timedrotatingfilehandler)101    - [Обработчик сокетов](https://python-all.ru/3.0/library/logging.html#sockethandler)102    - [Обработчик датаграмм](https://python-all.ru/3.0/library/logging.html#datagramhandler)103    - [Обработчик системного журнала](https://python-all.ru/3.0/library/logging.html#sysloghandler)104    - [Обработчик журнала событий NT](https://python-all.ru/3.0/library/logging.html#nteventloghandler)105    - [SMTP-обработчик](https://python-all.ru/3.0/library/logging.html#smtphandler)106    - [Обработчик памяти](https://python-all.ru/3.0/library/logging.html#memoryhandler)107    - [HTTP-обработчик](https://python-all.ru/3.0/library/logging.html#httphandler)108  - [Объекты-форматировщики](https://python-all.ru/3.0/library/logging.html#id1)109  - [Объекты-фильтры](https://python-all.ru/3.0/library/logging.html#filter-objects)110  - [Объекты LogRecord](https://python-all.ru/3.0/library/logging.html#logrecord-objects)111  - [Объекты LoggerAdapter](https://python-all.ru/3.0/library/logging.html#loggeradapter-objects)112  - [Потокобезопасность](https://python-all.ru/3.0/library/logging.html#thread-safety)113  - [Конфигурация](https://python-all.ru/3.0/library/logging.html#configuration)114115    - [Функции конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-functions)116    - [Формат файла конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-file-format)117    - [Пример сервера конфигурации](https://python-all.ru/3.0/library/logging.html#configuration-server-example)118  - [Дополнительные примеры](https://python-all.ru/3.0/library/logging.html#more-examples)119120    - [Несколько обработчиков и форматировщиков](https://python-all.ru/3.0/library/logging.html#multiple-handlers-and-formatters)121    - [Использование логирования в нескольких модулях](https://python-all.ru/3.0/library/logging.html#using-logging-in-multiple-modules)122- [`getpass` – Переносимый ввод пароля](https://python-all.ru/3.0/library/getpass.html)123- [`curses` – Управление терминалом для символьных дисплеев](https://python-all.ru/3.0/library/curses.html)124125  - [Функции](https://python-all.ru/3.0/library/curses.html#functions)126  - [Объекты окон](https://python-all.ru/3.0/library/curses.html#window-objects)127  - [Константы](https://python-all.ru/3.0/library/curses.html#constants)128- [`curses.textpad` – Виджет ввода текста для программ curses](https://python-all.ru/3.0/library/curses.html#module-curses.textpad)129130  - [Объекты Textbox](https://python-all.ru/3.0/library/curses.html#textbox-objects)131- [`curses.wrapper` – Обработчик терминала для программ curses](https://python-all.ru/3.0/library/curses.html#module-curses.wrapper)132- [`curses.ascii` – Утилиты для символов ASCII](https://python-all.ru/3.0/library/curses.ascii.html)133- [`curses.panel` – Расширение стека панелей для curses.](https://python-all.ru/3.0/library/curses.panel.html)134135  - [Функции](https://python-all.ru/3.0/library/curses.panel.html#functions)136  - [Объекты панелей](https://python-all.ru/3.0/library/curses.panel.html#panel-objects)137- [`platform` – Доступ к идентификационным данным базовой платформы.](https://python-all.ru/3.0/library/platform.html)138139  - [Кроссплатформенные](https://python-all.ru/3.0/library/platform.html#cross-platform)140  - [Платформа Java](https://python-all.ru/3.0/library/platform.html#java-platform)141  - [Платформа Windows](https://python-all.ru/3.0/library/platform.html#windows-platform)142143    - [Специфично для Win95/98](https://python-all.ru/3.0/library/platform.html#win95-98-specific)144  - [Платформа Mac OS](https://python-all.ru/3.0/library/platform.html#mac-os-platform)145  - [Платформы Unix](https://python-all.ru/3.0/library/platform.html#unix-platforms)146- [`errno` – Стандартные системные символы errno](https://python-all.ru/3.0/library/errno.html)147- [`ctypes` – Библиотека внешних функций для Python.](https://python-all.ru/3.0/library/ctypes.html)148149  - [Руководство по ctypes](https://python-all.ru/3.0/library/ctypes.html#ctypes-tutorial)150151    - [Загрузка библиотек динамической компоновки](https://python-all.ru/3.0/library/ctypes.html#loading-dynamic-link-libraries)152    - [Доступ к функциям из загруженных DLL](https://python-all.ru/3.0/library/ctypes.html#accessing-functions-from-loaded-dlls)153    - [Вызов функций](https://python-all.ru/3.0/library/ctypes.html#calling-functions)154    - [Базовые типы данных](https://python-all.ru/3.0/library/ctypes.html#fundamental-data-types)155    - [Вызов функций (продолжение)](https://python-all.ru/3.0/library/ctypes.html#calling-functions-continued)156    - [Вызов функций с собственными пользовательскими типами данных](https://python-all.ru/3.0/library/ctypes.html#calling-functions-with-your-own-custom-data-types)157    - [Указание требуемых типов аргументов (прототипы функций)](https://python-all.ru/3.0/library/ctypes.html#specifying-the-required-argument-types-function-prototypes)158    - [Типы возвращаемых значений](https://python-all.ru/3.0/library/ctypes.html#return-types)159    - [Передача указателей (или передача параметров по ссылке)](https://python-all.ru/3.0/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference)160    - [Структуры и объединения](https://python-all.ru/3.0/library/ctypes.html#structures-and-unions)161    - [Выравнивание структур/объединений и порядок байтов](https://python-all.ru/3.0/library/ctypes.html#structure-union-alignment-and-byte-order)162    - [Битовые поля в структурах и объединениях](https://python-all.ru/3.0/library/ctypes.html#bit-fields-in-structures-and-unions)163    - [Массивы](https://python-all.ru/3.0/library/ctypes.html#arrays)164    - [Указатели](https://python-all.ru/3.0/library/ctypes.html#pointers)165    - [Преобразования типов](https://python-all.ru/3.0/library/ctypes.html#type-conversions)166    - [Неполные типы](https://python-all.ru/3.0/library/ctypes.html#incomplete-types)167    - [Функции обратного вызова](https://python-all.ru/3.0/library/ctypes.html#callback-functions)168    - [Доступ к значениям, экспортируемым из DLL](https://python-all.ru/3.0/library/ctypes.html#accessing-values-exported-from-dlls)169    - [Неожиданности](https://python-all.ru/3.0/library/ctypes.html#surprises)170    - [Типы данных переменного размера](https://python-all.ru/3.0/library/ctypes.html#variable-sized-data-types)171  - [Справочник по ctypes](https://python-all.ru/3.0/library/ctypes.html#ctypes-reference)172173    - [Поиск общих библиотек](https://python-all.ru/3.0/library/ctypes.html#finding-shared-libraries)174    - [Загрузка общих библиотек](https://python-all.ru/3.0/library/ctypes.html#loading-shared-libraries)175    - [Внешние функции](https://python-all.ru/3.0/library/ctypes.html#foreign-functions)176    - [Прототипы функций](https://python-all.ru/3.0/library/ctypes.html#function-prototypes)177    - [Вспомогательные функции](https://python-all.ru/3.0/library/ctypes.html#utility-functions)178    - [Типы данных](https://python-all.ru/3.0/library/ctypes.html#data-types)179    - [Базовые типы данных](https://python-all.ru/3.0/library/ctypes.html#id1)180    - [Структурированные типы данных](https://python-all.ru/3.0/library/ctypes.html#structured-data-types)181    - [Массивы и указатели](https://python-all.ru/3.0/library/ctypes.html#arrays-and-pointers)182