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

allos.md

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

1> **Источник:** https://python-all.ru/3.12/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.12/library/os.html)1213  - [Имена файлов, аргументы командной строки и переменные окружения](https://python-all.ru/3.12/library/os.html#file-names-command-line-arguments-and-environment-variables)14  - [Режим UTF-8 в Python](https://python-all.ru/3.12/library/os.html#python-utf-8-mode)15  - [Параметры процесса](https://python-all.ru/3.12/library/os.html#process-parameters)16  - [Создание файловых объектов](https://python-all.ru/3.12/library/os.html#file-object-creation)17  - [Операции с файловыми дескрипторами](https://python-all.ru/3.12/library/os.html#file-descriptor-operations)1819    - [Определение размера терминала](https://python-all.ru/3.12/library/os.html#querying-the-size-of-a-terminal)20    - [Наследование файловых дескрипторов](https://python-all.ru/3.12/library/os.html#inheritance-of-file-descriptors)21  - [Файлы и каталоги](https://python-all.ru/3.12/library/os.html#files-and-directories)2223    - [Расширенные атрибуты Linux](https://python-all.ru/3.12/library/os.html#linux-extended-attributes)24  - [Управление процессами](https://python-all.ru/3.12/library/os.html#process-management)25  - [Интерфейс к планировщику](https://python-all.ru/3.12/library/os.html#interface-to-the-scheduler)26  - [Различная системная информация](https://python-all.ru/3.12/library/os.html#miscellaneous-system-information)27  - [Случайные числа](https://python-all.ru/3.12/library/os.html#random-numbers)28- [`io` – Основные инструменты для работы с потоками данных](https://python-all.ru/3.12/library/io.html)2930  - [Обзор](https://python-all.ru/3.12/library/io.html#overview)3132    - [Текстовый ввод/вывод](https://python-all.ru/3.12/library/io.html#text-i-o)33    - [Двоичный ввод/вывод](https://python-all.ru/3.12/library/io.html#binary-i-o)34    - [Необработанный ввод/вывод](https://python-all.ru/3.12/library/io.html#raw-i-o)35  - [Кодировка текста](https://python-all.ru/3.12/library/io.html#text-encoding)3637    - [Добровольное предупреждение о кодировке](https://python-all.ru/3.12/library/io.html#opt-in-encodingwarning)38  - [Интерфейс модуля высокого уровня](https://python-all.ru/3.12/library/io.html#high-level-module-interface)39  - [Иерархия классов](https://python-all.ru/3.12/library/io.html#class-hierarchy)4041    - [Базовые классы ввода/вывода](https://python-all.ru/3.12/library/io.html#i-o-base-classes)42    - [Необработанный файловый ввод/вывод](https://python-all.ru/3.12/library/io.html#raw-file-i-o)43    - [Буферизированные потоки](https://python-all.ru/3.12/library/io.html#buffered-streams)44    - [Текстовый ввод/вывод](https://python-all.ru/3.12/library/io.html#id1)45  - [Производительность](https://python-all.ru/3.12/library/io.html#performance)4647    - [Двоичный ввод/вывод](https://python-all.ru/3.12/library/io.html#id2)48    - [Текстовый ввод/вывод](https://python-all.ru/3.12/library/io.html#id3)49    - [Многопоточность](https://python-all.ru/3.12/library/io.html#multi-threading)50    - [Реентерабельность](https://python-all.ru/3.12/library/io.html#reentrancy)51- [`time` – Доступ ко времени и преобразования](https://python-all.ru/3.12/library/time.html)5253  - [Функции](https://python-all.ru/3.12/library/time.html#functions)54  - [Константы идентификаторов часов](https://python-all.ru/3.12/library/time.html#clock-id-constants)55  - [Константы часовых поясов](https://python-all.ru/3.12/library/time.html#timezone-constants)56- [`argparse` – Парсер опций, аргументов и подкоманд командной строки](https://python-all.ru/3.12/library/argparse.html)5758  - [Объекты ArgumentParser](https://python-all.ru/3.12/library/argparse.html#argumentparser-objects)5960    - [prog](https://python-all.ru/3.12/library/argparse.html#prog)61    - [usage](https://python-all.ru/3.12/library/argparse.html#usage)62    - [description](https://python-all.ru/3.12/library/argparse.html#description)63    - [epilog](https://python-all.ru/3.12/library/argparse.html#epilog)64    - [parents](https://python-all.ru/3.12/library/argparse.html#parents)65    - [formatter\_class](https://python-all.ru/3.12/library/argparse.html#formatter-class)66    - [prefix\_chars](https://python-all.ru/3.12/library/argparse.html#prefix-chars)67    - [fromfile\_prefix\_chars](https://python-all.ru/3.12/library/argparse.html#fromfile-prefix-chars)68    - [argument\_default](https://python-all.ru/3.12/library/argparse.html#argument-default)69    - [allow\_abbrev](https://python-all.ru/3.12/library/argparse.html#allow-abbrev)70    - [conflict\_handler](https://python-all.ru/3.12/library/argparse.html#conflict-handler)71    - [add\_help](https://python-all.ru/3.12/library/argparse.html#add-help)72    - [exit\_on\_error](https://python-all.ru/3.12/library/argparse.html#exit-on-error)73  - [Метод add\_argument()](https://python-all.ru/3.12/library/argparse.html#the-add-argument-method)7475    - [name или flags](https://python-all.ru/3.12/library/argparse.html#name-or-flags)76    - [action](https://python-all.ru/3.12/library/argparse.html#action)77    - [nargs](https://python-all.ru/3.12/library/argparse.html#nargs)78    - [const](https://python-all.ru/3.12/library/argparse.html#const)79    - [default](https://python-all.ru/3.12/library/argparse.html#default)80    - [тип](https://python-all.ru/3.12/library/argparse.html#type)81    - [choices](https://python-all.ru/3.12/library/argparse.html#choices)82    - [required](https://python-all.ru/3.12/library/argparse.html#required)83    - [help](https://python-all.ru/3.12/library/argparse.html#help)84    - [metavar](https://python-all.ru/3.12/library/argparse.html#metavar)85    - [dest](https://python-all.ru/3.12/library/argparse.html#dest)86    - [Классы Action](https://python-all.ru/3.12/library/argparse.html#action-classes)87  - [Метод parse\_args()](https://python-all.ru/3.12/library/argparse.html#the-parse-args-method)8889    - [Синтаксис значений опций](https://python-all.ru/3.12/library/argparse.html#option-value-syntax)90    - [Недопустимые аргументы](https://python-all.ru/3.12/library/argparse.html#invalid-arguments)91    - [Аргументы, содержащие `-`](https://python-all.ru/3.12/library/argparse.html#arguments-containing)92    - [Сокращения аргументов (сопоставление по префиксу)](https://python-all.ru/3.12/library/argparse.html#argument-abbreviations-prefix-matching)93    - [За пределами `sys.argv`](https://python-all.ru/3.12/library/argparse.html#beyond-sys-argv)94    - [Объект Namespace](https://python-all.ru/3.12/library/argparse.html#the-namespace-object)95  - [Прочие утилиты](https://python-all.ru/3.12/library/argparse.html#other-utilities)9697    - [Подкоманды](https://python-all.ru/3.12/library/argparse.html#sub-commands)98    - [Объекты FileType](https://python-all.ru/3.12/library/argparse.html#filetype-objects)99    - [Группы аргументов](https://python-all.ru/3.12/library/argparse.html#argument-groups)100    - [Взаимное исключение](https://python-all.ru/3.12/library/argparse.html#mutual-exclusion)101    - [Значения по умолчанию парсера](https://python-all.ru/3.12/library/argparse.html#parser-defaults)102    - [Вывод справки](https://python-all.ru/3.12/library/argparse.html#printing-help)103    - [Частичный разбор](https://python-all.ru/3.12/library/argparse.html#partial-parsing)104    - [Настройка разбора файлов](https://python-all.ru/3.12/library/argparse.html#customizing-file-parsing)105    - [Методы завершения](https://python-all.ru/3.12/library/argparse.html#exiting-methods)106    - [Смешанный разбор](https://python-all.ru/3.12/library/argparse.html#intermixed-parsing)107    - [Регистрация пользовательских типов или действий](https://python-all.ru/3.12/library/argparse.html#registering-custom-types-or-actions)108  - [Исключения](https://python-all.ru/3.12/library/argparse.html#exceptions)109110    - [Учебное пособие по argparse](https://python-all.ru/3.12/howto/argparse.html)111112      - [Основные понятия](https://python-all.ru/3.12/howto/argparse.html#concepts)113      - [Основы](https://python-all.ru/3.12/howto/argparse.html#the-basics)114      - [Знакомство с позиционными аргументами](https://python-all.ru/3.12/howto/argparse.html#introducing-positional-arguments)115      - [Знакомство с необязательными аргументами](https://python-all.ru/3.12/howto/argparse.html#introducing-optional-arguments)116117        - [Короткие опции](https://python-all.ru/3.12/howto/argparse.html#short-options)118      - [Сочетание позиционных и необязательных аргументов](https://python-all.ru/3.12/howto/argparse.html#combining-positional-and-optional-arguments)119      - [Переходим к более сложным темам](https://python-all.ru/3.12/howto/argparse.html#getting-a-little-more-advanced)120121        - [Указание неоднозначных аргументов](https://python-all.ru/3.12/howto/argparse.html#specifying-ambiguous-arguments)122        - [Конфликтующие опции](https://python-all.ru/3.12/howto/argparse.html#conflicting-options)123      - [Как перевести вывод argparse](https://python-all.ru/3.12/howto/argparse.html#how-to-translate-the-argparse-output)124      - [Пользовательские преобразователи типов](https://python-all.ru/3.12/howto/argparse.html#custom-type-converters)125      - [Заключение](https://python-all.ru/3.12/howto/argparse.html#conclusion)126    - [Обновление кода optparse](https://python-all.ru/3.12/howto/argparse-optparse.html)127- [`getopt` – Парсер параметров командной строки в стиле C](https://python-all.ru/3.12/library/getopt.html)128- [`logging` – Средство журналирования для Python](https://python-all.ru/3.12/library/logging.html)129130  - [Объекты Logger](https://python-all.ru/3.12/library/logging.html#logger-objects)131  - [Уровни журналирования](https://python-all.ru/3.12/library/logging.html#logging-levels)132  - [Объекты-обработчики](https://python-all.ru/3.12/library/logging.html#handler-objects)133  - [Объекты-форматировщики](https://python-all.ru/3.12/library/logging.html#formatter-objects)134  - [Объекты-фильтры](https://python-all.ru/3.12/library/logging.html#filter-objects)135  - [Объекты LogRecord](https://python-all.ru/3.12/library/logging.html#logrecord-objects)136  - [Атрибуты LogRecord](https://python-all.ru/3.12/library/logging.html#logrecord-attributes)137  - [Объекты LoggerAdapter](https://python-all.ru/3.12/library/logging.html#loggeradapter-objects)138  - [Потокобезопасность](https://python-all.ru/3.12/library/logging.html#thread-safety)139  - [Функции уровня модуля](https://python-all.ru/3.12/library/logging.html#module-level-functions)140  - [Атрибуты уровня модуля](https://python-all.ru/3.12/library/logging.html#module-level-attributes)141  - [Интеграция с модулем warnings](https://python-all.ru/3.12/library/logging.html#integration-with-the-warnings-module)142- [`logging.config` – Конфигурация логирования](https://python-all.ru/3.12/library/logging.config.html)143144  - [Функции конфигурации](https://python-all.ru/3.12/library/logging.config.html#configuration-functions)145  - [Вопросы безопасности](https://python-all.ru/3.12/library/logging.config.html#security-considerations)146  - [Схема конфигурационного словаря](https://python-all.ru/3.12/library/logging.config.html#configuration-dictionary-schema)147148    - [Подробности схемы словаря](https://python-all.ru/3.12/library/logging.config.html#dictionary-schema-details)149    - [Инкрементальная конфигурация](https://python-all.ru/3.12/library/logging.config.html#incremental-configuration)150    - [Соединения объектов](https://python-all.ru/3.12/library/logging.config.html#object-connections)151    - [Пользовательские объекты](https://python-all.ru/3.12/library/logging.config.html#user-defined-objects)152    - [Порядок конфигурации обработчиков](https://python-all.ru/3.12/library/logging.config.html#handler-configuration-order)153    - [Доступ к внешним объектам](https://python-all.ru/3.12/library/logging.config.html#access-to-external-objects)154    - [Доступ к внутренним объектам](https://python-all.ru/3.12/library/logging.config.html#access-to-internal-objects)155    - [Разрешение импорта и пользовательские импортеры](https://python-all.ru/3.12/library/logging.config.html#import-resolution-and-custom-importers)156    - [Настройка QueueHandler и QueueListener](https://python-all.ru/3.12/library/logging.config.html#configuring-queuehandler-and-queuelistener)157  - [Формат файла конфигурации](https://python-all.ru/3.12/library/logging.config.html#configuration-file-format)158- [`logging.handlers` – Обработчики логирования](https://python-all.ru/3.12/library/logging.handlers.html)159160  - [StreamHandler](https://python-all.ru/3.12/library/logging.handlers.html#streamhandler)161  - [FileHandler](https://python-all.ru/3.12/library/logging.handlers.html#filehandler)162  - [NullHandler](https://python-all.ru/3.12/library/logging.handlers.html#nullhandler)163  - [WatchedFileHandler](https://python-all.ru/3.12/library/logging.handlers.html#watchedfilehandler)164  - [BaseRotatingHandler](https://python-all.ru/3.12/library/logging.handlers.html#baserotatinghandler)165  - [RotatingFileHandler](https://python-all.ru/3.12/library/logging.handlers.html#rotatingfilehandler)166  - [TimedRotatingFileHandler](https://python-all.ru/3.12/library/logging.handlers.html#timedrotatingfilehandler)167  - [Обработчик сокетов](https://python-all.ru/3.12/library/logging.handlers.html#sockethandler)168  - [Обработчик датаграмм](https://python-all.ru/3.12/library/logging.handlers.html#datagramhandler)169  - [Обработчик системного журнала](https://python-all.ru/3.12/library/logging.handlers.html#sysloghandler)170  - [Обработчик журнала событий NT](https://python-all.ru/3.12/library/logging.handlers.html#nteventloghandler)171  - [SMTP-обработчик](https://python-all.ru/3.12/library/logging.handlers.html#smtphandler)172  - [Обработчик памяти](https://python-all.ru/3.12/library/logging.handlers.html#memoryhandler)173  - [HTTP-обработчик](https://python-all.ru/3.12/library/logging.handlers.html#httphandler)174  - [Обработчик очереди](https://python-all.ru/3.12/library/logging.handlers.html#queuehandler)175  - [Прослушиватель очереди](https://python-all.ru/3.12/library/logging.handlers.html#queuelistener)176- [`getpass` – Переносимый ввод пароля](https://python-all.ru/3.12/library/getpass.html)177- [`curses` – Управление терминалом для символьных дисплеев](https://python-all.ru/3.12/library/curses.html)178179  - [Функции](https://python-all.ru/3.12/library/curses.html#functions)180  - [Объекты окон](https://python-all.ru/3.12/library/curses.html#window-objects)181  - [Константы](https://python-all.ru/3.12/library/curses.html#constants)182- [`curses.textpad` – виджет ввода текста для программ curses](https://python-all.ru/3.12/library/curses.html#module-curses.textpad)183184  - [Объекты Textbox](https://python-all.ru/3.12/library/curses.html#textbox-objects)185- [`curses.ascii` – утилиты для работы с ASCII-символами](https://python-all.ru/3.12/library/curses.ascii.html)186- [`curses.panel` – расширение стека панелей для curses](https://python-all.ru/3.12/library/curses.panel.html)187188  - [Функции](https://python-all.ru/3.12/library/curses.panel.html#functions)189  - [Объекты панелей](https://python-all.ru/3.12/library/curses.panel.html#panel-objects)190- [`platform` – Доступ к идентифицирующим данным базовой платформы](https://python-all.ru/3.12/library/platform.html)191192  - [Кроссплатформенные](https://python-all.ru/3.12/library/platform.html#cross-platform)193  - [Платформа Java](https://python-all.ru/3.12/library/platform.html#java-platform)194  - [Платформа Windows](https://python-all.ru/3.12/library/platform.html#windows-platform)195  - [Платформа macOS](https://python-all.ru/3.12/library/platform.html#macos-platform)196  - [Платформы Unix](https://python-all.ru/3.12/library/platform.html#unix-platforms)197  - [Платформы Linux](https://python-all.ru/3.12/library/platform.html#linux-platforms)198- [`errno` – Стандартные системные символы errno](https://python-all.ru/3.12/library/errno.html)199- [`ctypes` – Библиотека внешних функций для Python](https://python-all.ru/3.12/library/ctypes.html)200201  - [Руководство по ctypes](https://python-all.ru/3.12/library/ctypes.html#ctypes-tutorial)202203    - [Загрузка библиотек динамической компоновки](https://python-all.ru/3.12/library/ctypes.html#loading-dynamic-link-libraries)204    - [Доступ к функциям из загруженных DLL](https://python-all.ru/3.12/library/ctypes.html#accessing-functions-from-loaded-dlls)205    - [Вызов функций](https://python-all.ru/3.12/library/ctypes.html#calling-functions)206    - [Базовые типы данных](https://python-all.ru/3.12/library/ctypes.html#fundamental-data-types)207    - [Вызов функций (продолжение)](https://python-all.ru/3.12/library/ctypes.html#calling-functions-continued)208    - [Вызов функций с переменным числом аргументов](https://python-all.ru/3.12/library/ctypes.html#calling-variadic-functions)209    - [Вызов функций с собственными пользовательскими типами данных](https://python-all.ru/3.12/library/ctypes.html#calling-functions-with-your-own-custom-data-types)210    - [Указание требуемых типов аргументов (прототипы функций)](https://python-all.ru/3.12/library/ctypes.html#specifying-the-required-argument-types-function-prototypes)211    - [Типы возвращаемых значений](https://python-all.ru/3.12/library/ctypes.html#return-types)212    - [Передача указателей (или передача параметров по ссылке)](https://python-all.ru/3.12/library/ctypes.html#passing-pointers-or-passing-parameters-by-reference)213    - [Структуры и объединения](https://python-all.ru/3.12/library/ctypes.html#structures-and-unions)214    - [Выравнивание структур/объединений и порядок байтов](https://python-all.ru/3.12/library/ctypes.html#structure-union-alignment-and-byte-order)215    - [Битовые поля в структурах и объединениях](https://python-all.ru/3.12/library/ctypes.html#bit-fields-in-structures-and-unions)216    - [Массивы](https://python-all.ru/3.12/library/ctypes.html#arrays)217    - [Указатели](https://python-all.ru/3.12/library/ctypes.html#pointers)218    - [Преобразования типов](https://python-all.ru/3.12/library/ctypes.html#type-conversions)219    - [Неполные типы](https://python-all.ru/3.12/library/ctypes.html#incomplete-types)220    - [Функции обратного вызова](https://python-all.ru/3.12/library/ctypes.html#callback-functions)221    - [Доступ к значениям, экспортируемым из DLL](https://python-all.ru/3.12/library/ctypes.html#accessing-values-exported-from-dlls)222    - [Неожиданности](https://python-all.ru/3.12/library/ctypes.html#surprises)223    - [Типы данных переменного размера](https://python-all.ru/3.12/library/ctypes.html#variable-sized-data-types)224  - [Справочник по ctypes](https://python-all.ru/3.12/library/ctypes.html#ctypes-reference)225226    - [Поиск общих библиотек](https://python-all.ru/3.12/library/ctypes.html#finding-shared-libraries)227    - [Загрузка общих библиотек](https://python-all.ru/3.12/library/ctypes.html#loading-shared-libraries)228    - [Внешние функции](https://python-all.ru/3.12/library/ctypes.html#foreign-functions)229    - [Прототипы функций](https://python-all.ru/3.12/library/ctypes.html#function-prototypes)230    - [Вспомогательные функции](https://python-all.ru/3.12/library/ctypes.html#utility-functions)231    - [Типы данных](https://python-all.ru/3.12/library/ctypes.html#data-types)232    - [Базовые типы данных](https://python-all.ru/3.12/library/ctypes.html#ctypes-fundamental-data-types-2)233    - [Структурированные типы данных](https://python-all.ru/3.12/library/ctypes.html#structured-data-types)234    - [Массивы и указатели](https://python-all.ru/3.12/library/ctypes.html#arrays-and-pointers)235