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

allos.md

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

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