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

allos.md

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

1> **Источник:** https://python-all.ru/3.9/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.9/library/os.html)1213  - [Имена файлов, аргументы командной строки и переменные окружения](https://python-all.ru/3.9/library/os.html#file-names-command-line-arguments-and-environment-variables)14  - [Параметры процесса](https://python-all.ru/3.9/library/os.html#process-parameters)15  - [Создание файловых объектов](https://python-all.ru/3.9/library/os.html#file-object-creation)16  - [Операции с файловыми дескрипторами](https://python-all.ru/3.9/library/os.html#file-descriptor-operations)1718    - [Определение размера терминала](https://python-all.ru/3.9/library/os.html#querying-the-size-of-a-terminal)19    - [Наследование файловых дескрипторов](https://python-all.ru/3.9/library/os.html#inheritance-of-file-descriptors)20  - [Файлы и каталоги](https://python-all.ru/3.9/library/os.html#files-and-directories)2122    - [Расширенные атрибуты Linux](https://python-all.ru/3.9/library/os.html#linux-extended-attributes)23  - [Управление процессами](https://python-all.ru/3.9/library/os.html#process-management)24  - [Интерфейс к планировщику](https://python-all.ru/3.9/library/os.html#interface-to-the-scheduler)25  - [Различная системная информация](https://python-all.ru/3.9/library/os.html#miscellaneous-system-information)26  - [Случайные числа](https://python-all.ru/3.9/library/os.html#random-numbers)27- [`io` – Основные инструменты для работы с потоками данных](https://python-all.ru/3.9/library/io.html)2829  - [Обзор](https://python-all.ru/3.9/library/io.html#overview)3031    - [Текстовый ввод/вывод](https://python-all.ru/3.9/library/io.html#text-i-o)32    - [Двоичный ввод/вывод](https://python-all.ru/3.9/library/io.html#binary-i-o)33    - [Необработанный ввод/вывод](https://python-all.ru/3.9/library/io.html#raw-i-o)34  - [Интерфейс модуля высокого уровня](https://python-all.ru/3.9/library/io.html#high-level-module-interface)35  - [Иерархия классов](https://python-all.ru/3.9/library/io.html#class-hierarchy)3637    - [Базовые классы ввода/вывода](https://python-all.ru/3.9/library/io.html#i-o-base-classes)38    - [Необработанный файловый ввод/вывод](https://python-all.ru/3.9/library/io.html#raw-file-i-o)39    - [Буферизированные потоки](https://python-all.ru/3.9/library/io.html#buffered-streams)40    - [Текстовый ввод/вывод](https://python-all.ru/3.9/library/io.html#id1)41  - [Производительность](https://python-all.ru/3.9/library/io.html#performance)4243    - [Двоичный ввод/вывод](https://python-all.ru/3.9/library/io.html#id2)44    - [Текстовый ввод/вывод](https://python-all.ru/3.9/library/io.html#id3)45    - [Многопоточность](https://python-all.ru/3.9/library/io.html#multi-threading)46    - [Реентерабельность](https://python-all.ru/3.9/library/io.html#reentrancy)47- [`time` – Доступ ко времени и преобразования](https://python-all.ru/3.9/library/time.html)4849  - [Функции](https://python-all.ru/3.9/library/time.html#functions)50  - [Константы идентификаторов часов](https://python-all.ru/3.9/library/time.html#clock-id-constants)51  - [Константы часовых поясов](https://python-all.ru/3.9/library/time.html#timezone-constants)52- [`argparse` – Парсер параметров командной строки, аргументов и подкоманд](https://python-all.ru/3.9/library/argparse.html)5354  - [Пример](https://python-all.ru/3.9/library/argparse.html#example)5556    - [Создание парсера](https://python-all.ru/3.9/library/argparse.html#creating-a-parser)57    - [Добавление аргументов](https://python-all.ru/3.9/library/argparse.html#adding-arguments)58    - [Разбор аргументов](https://python-all.ru/3.9/library/argparse.html#parsing-arguments)59  - [Объекты ArgumentParser](https://python-all.ru/3.9/library/argparse.html#argumentparser-objects)6061    - [prog](https://python-all.ru/3.9/library/argparse.html#prog)62    - [usage](https://python-all.ru/3.9/library/argparse.html#usage)63    - [description](https://python-all.ru/3.9/library/argparse.html#description)64    - [epilog](https://python-all.ru/3.9/library/argparse.html#epilog)65    - [parents](https://python-all.ru/3.9/library/argparse.html#parents)66    - [formatter\_class](https://python-all.ru/3.9/library/argparse.html#formatter-class)67    - [prefix\_chars](https://python-all.ru/3.9/library/argparse.html#prefix-chars)68    - [fromfile\_prefix\_chars](https://python-all.ru/3.9/library/argparse.html#fromfile-prefix-chars)69    - [argument\_default](https://python-all.ru/3.9/library/argparse.html#argument-default)70    - [allow\_abbrev](https://python-all.ru/3.9/library/argparse.html#allow-abbrev)71    - [conflict\_handler](https://python-all.ru/3.9/library/argparse.html#conflict-handler)72    - [add\_help](https://python-all.ru/3.9/library/argparse.html#add-help)73    - [exit\_on\_error](https://python-all.ru/3.9/library/argparse.html#exit-on-error)74  - [Метод add\_argument()](https://python-all.ru/3.9/library/argparse.html#the-add-argument-method)7576    - [name или flags](https://python-all.ru/3.9/library/argparse.html#name-or-flags)77    - [action](https://python-all.ru/3.9/library/argparse.html#action)78    - [nargs](https://python-all.ru/3.9/library/argparse.html#nargs)79    - [const](https://python-all.ru/3.9/library/argparse.html#const)80    - [default](https://python-all.ru/3.9/library/argparse.html#default)81    - [тип](https://python-all.ru/3.9/library/argparse.html#type)82    - [choices](https://python-all.ru/3.9/library/argparse.html#choices)83    - [required](https://python-all.ru/3.9/library/argparse.html#required)84    - [help](https://python-all.ru/3.9/library/argparse.html#help)85    - [metavar](https://python-all.ru/3.9/library/argparse.html#metavar)86    - [dest](https://python-all.ru/3.9/library/argparse.html#dest)87    - [Классы Action](https://python-all.ru/3.9/library/argparse.html#action-classes)88  - [Метод parse\_args()](https://python-all.ru/3.9/library/argparse.html#the-parse-args-method)8990    - [Синтаксис значений опций](https://python-all.ru/3.9/library/argparse.html#option-value-syntax)91    - [Недопустимые аргументы](https://python-all.ru/3.9/library/argparse.html#invalid-arguments)92    - [Аргументы, содержащие `-`](https://python-all.ru/3.9/library/argparse.html#arguments-containing)93    - [Сокращения аргументов (сопоставление по префиксу)](https://python-all.ru/3.9/library/argparse.html#argument-abbreviations-prefix-matching)94    - [За пределами `sys.argv`](https://python-all.ru/3.9/library/argparse.html#beyond-sys-argv)95    - [Объект Namespace](https://python-all.ru/3.9/library/argparse.html#the-namespace-object)96  - [Прочие утилиты](https://python-all.ru/3.9/library/argparse.html#other-utilities)9798    - [Подкоманды](https://python-all.ru/3.9/library/argparse.html#sub-commands)99    - [Объекты FileType](https://python-all.ru/3.9/library/argparse.html#filetype-objects)100    - [Группы аргументов](https://python-all.ru/3.9/library/argparse.html#argument-groups)101    - [Взаимное исключение](https://python-all.ru/3.9/library/argparse.html#mutual-exclusion)102    - [Значения по умолчанию парсера](https://python-all.ru/3.9/library/argparse.html#parser-defaults)103    - [Вывод справки](https://python-all.ru/3.9/library/argparse.html#printing-help)104    - [Частичный разбор](https://python-all.ru/3.9/library/argparse.html#partial-parsing)105    - [Настройка разбора файлов](https://python-all.ru/3.9/library/argparse.html#customizing-file-parsing)106    - [Методы завершения](https://python-all.ru/3.9/library/argparse.html#exiting-methods)107    - [Смешанный разбор](https://python-all.ru/3.9/library/argparse.html#intermixed-parsing)108  - [Обновление кода optparse](https://python-all.ru/3.9/library/argparse.html#upgrading-optparse-code)109- [`getopt` – Парсер параметров командной строки в стиле C](https://python-all.ru/3.9/library/getopt.html)110- [`logging` – Средство журналирования для Python](https://python-all.ru/3.9/library/logging.html)111112  - [Объекты Logger](https://python-all.ru/3.9/library/logging.html#logger-objects)113  - [Уровни журналирования](https://python-all.ru/3.9/library/logging.html#logging-levels)114  - [Объекты-обработчики](https://python-all.ru/3.9/library/logging.html#handler-objects)115  - [Объекты-форматировщики](https://python-all.ru/3.9/library/logging.html#formatter-objects)116  - [Объекты-фильтры](https://python-all.ru/3.9/library/logging.html#filter-objects)117  - [Объекты LogRecord](https://python-all.ru/3.9/library/logging.html#logrecord-objects)118  - [Атрибуты LogRecord](https://python-all.ru/3.9/library/logging.html#logrecord-attributes)119  - [Объекты LoggerAdapter](https://python-all.ru/3.9/library/logging.html#loggeradapter-objects)120  - [Потокобезопасность](https://python-all.ru/3.9/library/logging.html#thread-safety)121  - [Функции уровня модуля](https://python-all.ru/3.9/library/logging.html#module-level-functions)122  - [Атрибуты уровня модуля](https://python-all.ru/3.9/library/logging.html#module-level-attributes)123  - [Интеграция с модулем warnings](https://python-all.ru/3.9/library/logging.html#integration-with-the-warnings-module)124- [`logging.config` – Конфигурация логирования](https://python-all.ru/3.9/library/logging.config.html)125126  - [Функции конфигурации](https://python-all.ru/3.9/library/logging.config.html#configuration-functions)127  - [Вопросы безопасности](https://python-all.ru/3.9/library/logging.config.html#security-considerations)128  - [Схема конфигурационного словаря](https://python-all.ru/3.9/library/logging.config.html#configuration-dictionary-schema)129130    - [Подробности схемы словаря](https://python-all.ru/3.9/library/logging.config.html#dictionary-schema-details)131    - [Инкрементальная конфигурация](https://python-all.ru/3.9/library/logging.config.html#incremental-configuration)132    - [Соединения объектов](https://python-all.ru/3.9/library/logging.config.html#object-connections)133    - [Пользовательские объекты](https://python-all.ru/3.9/library/logging.config.html#user-defined-objects)134    - [Доступ к внешним объектам](https://python-all.ru/3.9/library/logging.config.html#access-to-external-objects)135    - [Доступ к внутренним объектам](https://python-all.ru/3.9/library/logging.config.html#access-to-internal-objects)136    - [Разрешение импорта и пользовательские импортеры](https://python-all.ru/3.9/library/logging.config.html#import-resolution-and-custom-importers)137  - [Формат файла конфигурации](https://python-all.ru/3.9/library/logging.config.html#configuration-file-format)138- [`logging.handlers` – Обработчики логирования](https://python-all.ru/3.9/library/logging.handlers.html)139140  - [StreamHandler](https://python-all.ru/3.9/library/logging.handlers.html#streamhandler)141  - [FileHandler](https://python-all.ru/3.9/library/logging.handlers.html#filehandler)142  - [NullHandler](https://python-all.ru/3.9/library/logging.handlers.html#nullhandler)143  - [WatchedFileHandler](https://python-all.ru/3.9/library/logging.handlers.html#watchedfilehandler)144  - [BaseRotatingHandler](https://python-all.ru/3.9/library/logging.handlers.html#baserotatinghandler)145  - [RotatingFileHandler](https://python-all.ru/3.9/library/logging.handlers.html#rotatingfilehandler)146  - [TimedRotatingFileHandler](https://python-all.ru/3.9/library/logging.handlers.html#timedrotatingfilehandler)147  - [Обработчик сокетов](https://python-all.ru/3.9/library/logging.handlers.html#sockethandler)148  - [Обработчик датаграмм](https://python-all.ru/3.9/library/logging.handlers.html#datagramhandler)149  - [Обработчик системного журнала](https://python-all.ru/3.9/library/logging.handlers.html#sysloghandler)150  - [Обработчик журнала событий NT](https://python-all.ru/3.9/library/logging.handlers.html#nteventloghandler)151  - [SMTP-обработчик](https://python-all.ru/3.9/library/logging.handlers.html#smtphandler)152  - [Обработчик памяти](https://python-all.ru/3.9/library/logging.handlers.html#memoryhandler)153  - [HTTP-обработчик](https://python-all.ru/3.9/library/logging.handlers.html#httphandler)154  - [Обработчик очереди](https://python-all.ru/3.9/library/logging.handlers.html#queuehandler)155  - [Прослушиватель очереди](https://python-all.ru/3.9/library/logging.handlers.html#queuelistener)156- [`getpass` – Переносимый ввод пароля](https://python-all.ru/3.9/library/getpass.html)157- [`curses` – Управление терминалом для символьных дисплеев](https://python-all.ru/3.9/library/curses.html)158159  - [Функции](https://python-all.ru/3.9/library/curses.html#functions)160  - [Объекты окон](https://python-all.ru/3.9/library/curses.html#window-objects)161  - [Константы](https://python-all.ru/3.9/library/curses.html#constants)162- [`curses.textpad` – виджет ввода текста для программ curses](https://python-all.ru/3.9/library/curses.html#module-curses.textpad)163164  - [Объекты Textbox](https://python-all.ru/3.9/library/curses.html#textbox-objects)165- [`curses.ascii` – утилиты для работы с ASCII-символами](https://python-all.ru/3.9/library/curses.ascii.html)166- [`curses.panel` – расширение стека панелей для curses](https://python-all.ru/3.9/library/curses.panel.html)167168  - [Функции](https://python-all.ru/3.9/library/curses.panel.html#functions)169  - [Объекты панелей](https://python-all.ru/3.9/library/curses.panel.html#panel-objects)170- [`platform` – Доступ к идентифицирующим данным базовой платформы](https://python-all.ru/3.9/library/platform.html)171172  - [Кроссплатформенные](https://python-all.ru/3.9/library/platform.html#cross-platform)173  - [Платформа Java](https://python-all.ru/3.9/library/platform.html#java-platform)174  - [Платформа Windows](https://python-all.ru/3.9/library/platform.html#windows-platform)175  - [Платформа macOS](https://python-all.ru/3.9/library/platform.html#macos-platform)176  - [Платформы Unix](https://python-all.ru/3.9/library/platform.html#unix-platforms)177- [`errno` – Стандартные системные символы errno](https://python-all.ru/3.9/library/errno.html)178- [`ctypes` – Библиотека внешних функций для Python](https://python-all.ru/3.9/library/ctypes.html)179180  - [Руководство по ctypes](https://python-all.ru/3.9/library/ctypes.html#ctypes-tutorial)181182    - [Загрузка библиотек динамической компоновки](https://python-all.ru/3.9/library/ctypes.html#loading-dynamic-link-libraries)183    - [Доступ к функциям из загруженных DLL](https://python-all.ru/3.9/library/ctypes.html#accessing-functions-from-loaded-dlls)184    - [Вызов функций](https://python-all.ru/3.9/library/ctypes.html#calling-functions)185    - [Базовые типы данных](https://python-all.ru/3.9/library/ctypes.html#fundamental-data-types)186    - [Вызов функций (продолжение)](https://python-all.ru/3.9/library/ctypes.html#calling-functions-continued)187    - [Вызов функций с собственными пользовательскими типами данных](https://python-all.ru/3.9/library/ctypes.html#calling-functions-with-your-own-custom-data-types)188    - [Указание требуемых типов аргументов (прототипы функций)](https://python-all.ru/3.9/library/ctypes.html#specifying-the-required-argument-types-function-prototypes)189    - [Типы возвращаемых значений](https://python-all.ru/3.9/library/ctypes.html#return-types)190    - [Передача указателей (или передача параметров по ссылке)](https://python-all.ru/3.9/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference)191    - [Структуры и объединения](https://python-all.ru/3.9/library/ctypes.html#structures-and-unions)192    - [Выравнивание структур/объединений и порядок байтов](https://python-all.ru/3.9/library/ctypes.html#structure-union-alignment-and-byte-order)193    - [Битовые поля в структурах и объединениях](https://python-all.ru/3.9/library/ctypes.html#bit-fields-in-structures-and-unions)194    - [Массивы](https://python-all.ru/3.9/library/ctypes.html#arrays)195    - [Указатели](https://python-all.ru/3.9/library/ctypes.html#pointers)196    - [Преобразования типов](https://python-all.ru/3.9/library/ctypes.html#type-conversions)197    - [Неполные типы](https://python-all.ru/3.9/library/ctypes.html#incomplete-types)198    - [Функции обратного вызова](https://python-all.ru/3.9/library/ctypes.html#callback-functions)199    - [Доступ к значениям, экспортируемым из DLL](https://python-all.ru/3.9/library/ctypes.html#accessing-values-exported-from-dlls)200    - [Неожиданности](https://python-all.ru/3.9/library/ctypes.html#surprises)201    - [Типы данных переменного размера](https://python-all.ru/3.9/library/ctypes.html#variable-sized-data-types)202  - [Справочник по ctypes](https://python-all.ru/3.9/library/ctypes.html#ctypes-reference)203204    - [Поиск общих библиотек](https://python-all.ru/3.9/library/ctypes.html#finding-shared-libraries)205    - [Загрузка общих библиотек](https://python-all.ru/3.9/library/ctypes.html#loading-shared-libraries)206    - [Внешние функции](https://python-all.ru/3.9/library/ctypes.html#foreign-functions)207    - [Прототипы функций](https://python-all.ru/3.9/library/ctypes.html#function-prototypes)208    - [Вспомогательные функции](https://python-all.ru/3.9/library/ctypes.html#utility-functions)209    - [Типы данных](https://python-all.ru/3.9/library/ctypes.html#data-types)210    - [Базовые типы данных](https://python-all.ru/3.9/library/ctypes.html#ctypes-fundamental-data-types-2)211    - [Структурированные типы данных](https://python-all.ru/3.9/library/ctypes.html#structured-data-types)212    - [Массивы и указатели](https://python-all.ru/3.9/library/ctypes.html#arrays-and-pointers)213