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

allos.md

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

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