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

index.md

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

1> **Источник:** https://python-all.ru/3.0/tutorial/index.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Учебник Python89| Версия: | 3.0 |10| --- | --- |11| Дата: | 14 февраля 2009 |1213Python – это простой для изучения, но мощный язык программирования. В нём эффективные высокоуровневые структуры данных и простой, но эффективный подход к объектно-ориентированному программированию. Элегантный синтаксис Python, динамическая типизация в сочетании с интерпретируемостью делают его идеальным языком для написания сценариев и быстрой разработки приложений в самых разных областях на большинстве платформ.1415Интерпретатор Python и обширная стандартная библиотека доступны бесплатно в исходном или двоичном виде для всех основных платформ на сайте Python, [http://www.python.org/](https://python-all.ru/3.0/tutorial/index.html), и могут свободно распространяться. На этом же сайте также размещены дистрибутивы и ссылки на множество бесплатных сторонних модулей Python, программ и инструментов, а также дополнительная документация.1617Интерпретатор Python легко расширяется новыми функциями и типами данных, реализованными на C или C++ (или других языках, вызываемых из C). Python также подходит как язык расширения для настраиваемых приложений.1819Этот учебник в неформальной манере знакомит с основными понятиями и особенностями языка Python и его системы. Желательно иметь под рукой интерпретатор Python для получения практического опыта, но все примеры самодостаточны, поэтому учебник можно читать и в автономном режиме.2021Описание стандартных объектов и модулей см. в документе «Справочник по библиотеке Python». В «Справочном руководстве по Python» дано более формальное определение языка. Для написания расширений на C или C++ читайте «Расширение и встраивание интерпретатора Python» и «Справочник по Python/C API». Также существует несколько книг, подробно освещающих Python.2223Данное руководство не пытается быть исчерпывающим и охватить каждую отдельную возможность или даже каждую часто используемую возможность. Вместо этого оно знакомит с наиболее примечательными возможностями Python и даёт представление о духе и стиле языка. После его прочтения вы сможете читать и писать модули и программы на Python, а также будете готовы узнать больше о различных модулях библиотеки Python, описанных в «Справочнике по библиотеке Python».2425[*Глоссарий*](https://python-all.ru/3.0/glossary.html#glossary) тоже стоит просмотреть.2627- [Разжигание аппетита](https://python-all.ru/3.0/tutorial/appetite.html)28- [Использование интерпретатора Python](https://python-all.ru/3.0/tutorial/interpreter.html)2930  - [Запуск интерпретатора](https://python-all.ru/3.0/tutorial/interpreter.html#invoking-the-interpreter)3132    - [Передача аргументов](https://python-all.ru/3.0/tutorial/interpreter.html#argument-passing)33    - [Интерактивный режим](https://python-all.ru/3.0/tutorial/interpreter.html#interactive-mode)34  - [Интерпретатор и его окружение](https://python-all.ru/3.0/tutorial/interpreter.html#the-interpreter-and-its-environment)3536    - [Обработка ошибок](https://python-all.ru/3.0/tutorial/interpreter.html#error-handling)37    - [Исполняемые скрипты Python](https://python-all.ru/3.0/tutorial/interpreter.html#executable-python-scripts)38    - [Кодировка исходного кода](https://python-all.ru/3.0/tutorial/interpreter.html#source-code-encoding)39    - [Интерактивный файл запуска](https://python-all.ru/3.0/tutorial/interpreter.html#the-interactive-startup-file)40- [Неофициальное введение в Python](https://python-all.ru/3.0/tutorial/introduction.html)4142  - [Использование Python как калькулятора](https://python-all.ru/3.0/tutorial/introduction.html#using-python-as-a-calculator)4344    - [Числа](https://python-all.ru/3.0/tutorial/introduction.html#numbers)45    - [Строки](https://python-all.ru/3.0/tutorial/introduction.html#strings)46    - [О Юникоде](https://python-all.ru/3.0/tutorial/introduction.html#about-unicode)47    - [Списки](https://python-all.ru/3.0/tutorial/introduction.html#lists)48  - [Первые шаги в программировании](https://python-all.ru/3.0/tutorial/introduction.html#first-steps-towards-programming)49- [Дополнительные средства управления потоком](https://python-all.ru/3.0/tutorial/controlflow.html)5051  - [`if` инструкции](https://python-all.ru/3.0/tutorial/controlflow.html#if-statements)52  - [`for` инструкции](https://python-all.ru/3.0/tutorial/controlflow.html#for-statements)53  - [Функция `range()`](https://python-all.ru/3.0/tutorial/controlflow.html#the-range-function)54  - [`break` и `continue` инструкции, и `else` предложения в циклах](https://python-all.ru/3.0/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops)55  - [`pass` инструкции](https://python-all.ru/3.0/tutorial/controlflow.html#pass-statements)56  - [Определение функций](https://python-all.ru/3.0/tutorial/controlflow.html#defining-functions)57  - [Подробнее об определении функций](https://python-all.ru/3.0/tutorial/controlflow.html#more-on-defining-functions)5859    - [Значения аргументов по умолчанию](https://python-all.ru/3.0/tutorial/controlflow.html#default-argument-values)60    - [Именованные аргументы](https://python-all.ru/3.0/tutorial/controlflow.html#keyword-arguments)61    - [Произвольные списки аргументов](https://python-all.ru/3.0/tutorial/controlflow.html#arbitrary-argument-lists)62    - [Распаковка списков аргументов](https://python-all.ru/3.0/tutorial/controlflow.html#unpacking-argument-lists)63    - [Лямбда-выражения](https://python-all.ru/3.0/tutorial/controlflow.html#lambda-forms)64    - [Строки документации](https://python-all.ru/3.0/tutorial/controlflow.html#documentation-strings)65  - [Интермеццо: Стиль кода](https://python-all.ru/3.0/tutorial/controlflow.html#intermezzo-coding-style)66- [Структуры данных](https://python-all.ru/3.0/tutorial/datastructures.html)6768  - [Подробнее о списках](https://python-all.ru/3.0/tutorial/datastructures.html#more-on-lists)6970    - [Использование списков в качестве стеков](https://python-all.ru/3.0/tutorial/datastructures.html#using-lists-as-stacks)71    - [Использование списков в качестве очередей](https://python-all.ru/3.0/tutorial/datastructures.html#using-lists-as-queues)72    - [Списковые включения](https://python-all.ru/3.0/tutorial/datastructures.html#list-comprehensions)73    - [Вложенные списковые включения](https://python-all.ru/3.0/tutorial/datastructures.html#nested-list-comprehensions)74  - [Инструкция `del`](https://python-all.ru/3.0/tutorial/datastructures.html#the-del-statement)75  - [Кортежи и последовательности](https://python-all.ru/3.0/tutorial/datastructures.html#tuples-and-sequences)76  - [Множества](https://python-all.ru/3.0/tutorial/datastructures.html#sets)77  - [Словари](https://python-all.ru/3.0/tutorial/datastructures.html#dictionaries)78  - [Приёмы работы с циклами](https://python-all.ru/3.0/tutorial/datastructures.html#looping-techniques)79  - [Подробнее об условиях](https://python-all.ru/3.0/tutorial/datastructures.html#more-on-conditions)80  - [Сравнение последовательностей и других типов](https://python-all.ru/3.0/tutorial/datastructures.html#comparing-sequences-and-other-types)81- [Модули](https://python-all.ru/3.0/tutorial/modules.html)8283  - [Подробнее о модулях](https://python-all.ru/3.0/tutorial/modules.html#more-on-modules)8485    - [Запуск модулей как скриптов](https://python-all.ru/3.0/tutorial/modules.html#executing-modules-as-scripts)86    - [Путь поиска модулей](https://python-all.ru/3.0/tutorial/modules.html#the-module-search-path)87    - [«Скомпилированные» файлы Python](https://python-all.ru/3.0/tutorial/modules.html#compiled-python-files)88  - [Стандартные модули](https://python-all.ru/3.0/tutorial/modules.html#standard-modules)89  - [Функция `dir()`](https://python-all.ru/3.0/tutorial/modules.html#the-dir-function)90  - [Пакеты](https://python-all.ru/3.0/tutorial/modules.html#packages)9192    - [Импорт \* из пакета](https://python-all.ru/3.0/tutorial/modules.html#importing-from-a-package)93    - [Ссылки внутри пакета](https://python-all.ru/3.0/tutorial/modules.html#intra-package-references)94    - [Пакеты в нескольких каталогах](https://python-all.ru/3.0/tutorial/modules.html#packages-in-multiple-directories)95- [Ввод и вывод](https://python-all.ru/3.0/tutorial/inputoutput.html)9697  - [Более изощрённое форматирование вывода](https://python-all.ru/3.0/tutorial/inputoutput.html#fancier-output-formatting)9899    - [Старое форматирование строк](https://python-all.ru/3.0/tutorial/inputoutput.html#old-string-formatting)100  - [Чтение и запись файлов](https://python-all.ru/3.0/tutorial/inputoutput.html#reading-and-writing-files)101102    - [Методы файловых объектов](https://python-all.ru/3.0/tutorial/inputoutput.html#methods-of-file-objects)103    - [Модуль `pickle`](https://python-all.ru/3.0/tutorial/inputoutput.html#the-pickle-module)104- [Ошибки и исключения](https://python-all.ru/3.0/tutorial/errors.html)105106  - [Синтаксические ошибки](https://python-all.ru/3.0/tutorial/errors.html#syntax-errors)107  - [Исключения](https://python-all.ru/3.0/tutorial/errors.html#exceptions)108  - [Обработка исключений](https://python-all.ru/3.0/tutorial/errors.html#handling-exceptions)109  - [Возбуждение исключений](https://python-all.ru/3.0/tutorial/errors.html#raising-exceptions)110  - [Определяемые пользователем исключения](https://python-all.ru/3.0/tutorial/errors.html#user-defined-exceptions)111  - [Определение действий по очистке](https://python-all.ru/3.0/tutorial/errors.html#defining-clean-up-actions)112  - [Предопределённые действия по очистке](https://python-all.ru/3.0/tutorial/errors.html#predefined-clean-up-actions)113- [Классы](https://python-all.ru/3.0/tutorial/classes.html)114115  - [Несколько слов о терминологии](https://python-all.ru/3.0/tutorial/classes.html#a-word-about-terminology)116  - [Области видимости и пространства имён в Python](https://python-all.ru/3.0/tutorial/classes.html#python-scopes-and-name-spaces)117118    - [Пример областей видимости и пространств имён](https://python-all.ru/3.0/tutorial/classes.html#scopes-and-namespaces-example)119  - [Первое знакомство с классами](https://python-all.ru/3.0/tutorial/classes.html#a-first-look-at-classes)120121    - [Синтаксис определения класса](https://python-all.ru/3.0/tutorial/classes.html#class-definition-syntax)122    - [Объекты классов](https://python-all.ru/3.0/tutorial/classes.html#class-objects)123    - [Объекты экземпляров](https://python-all.ru/3.0/tutorial/classes.html#instance-objects)124    - [Объекты методов](https://python-all.ru/3.0/tutorial/classes.html#method-objects)125  - [Разные замечания](https://python-all.ru/3.0/tutorial/classes.html#random-remarks)126  - [Наследование](https://python-all.ru/3.0/tutorial/classes.html#inheritance)127128    - [Множественное наследование](https://python-all.ru/3.0/tutorial/classes.html#multiple-inheritance)129  - [Приватные переменные](https://python-all.ru/3.0/tutorial/classes.html#private-variables)130  - [Разное](https://python-all.ru/3.0/tutorial/classes.html#odds-and-ends)131  - [Исключения – это тоже классы](https://python-all.ru/3.0/tutorial/classes.html#exceptions-are-classes-too)132  - [Итераторы](https://python-all.ru/3.0/tutorial/classes.html#iterators)133  - [Генераторы](https://python-all.ru/3.0/tutorial/classes.html#generators)134  - [Генераторные выражения](https://python-all.ru/3.0/tutorial/classes.html#generator-expressions)135- [Краткий обзор стандартной библиотеки](https://python-all.ru/3.0/tutorial/stdlib.html)136137  - [Интерфейс операционной системы](https://python-all.ru/3.0/tutorial/stdlib.html#operating-system-interface)138  - [Шаблоны имён файлов](https://python-all.ru/3.0/tutorial/stdlib.html#file-wildcards)139  - [Аргументы командной строки](https://python-all.ru/3.0/tutorial/stdlib.html#command-line-arguments)140  - [Перенаправление вывода ошибок и завершение программы](https://python-all.ru/3.0/tutorial/stdlib.html#error-output-redirection-and-program-termination)141  - [Поиск по шаблону в строках](https://python-all.ru/3.0/tutorial/stdlib.html#string-pattern-matching)142  - [Математика](https://python-all.ru/3.0/tutorial/stdlib.html#mathematics)143  - [Доступ к интернету](https://python-all.ru/3.0/tutorial/stdlib.html#internet-access)144  - [Даты и время](https://python-all.ru/3.0/tutorial/stdlib.html#dates-and-times)145  - [Сжатие данных](https://python-all.ru/3.0/tutorial/stdlib.html#data-compression)146  - [Измерение производительности](https://python-all.ru/3.0/tutorial/stdlib.html#performance-measurement)147  - [Контроль качества](https://python-all.ru/3.0/tutorial/stdlib.html#quality-control)148  - [Батарейки в комплекте](https://python-all.ru/3.0/tutorial/stdlib.html#batteries-included)149- [Краткий обзор стандартной библиотеки – часть II](https://python-all.ru/3.0/tutorial/stdlib2.html)150151  - [Форматирование вывода](https://python-all.ru/3.0/tutorial/stdlib2.html#output-formatting)152  - [Шаблоны](https://python-all.ru/3.0/tutorial/stdlib2.html#templating)153  - [Работа с двоичными данными: структуры записей](https://python-all.ru/3.0/tutorial/stdlib2.html#working-with-binary-data-record-layouts)154  - [Многопоточность](https://python-all.ru/3.0/tutorial/stdlib2.html#multi-threading)155  - [Логирование](https://python-all.ru/3.0/tutorial/stdlib2.html#logging)156  - [Слабые ссылки](https://python-all.ru/3.0/tutorial/stdlib2.html#weak-references)157  - [Инструменты для работы со списками](https://python-all.ru/3.0/tutorial/stdlib2.html#tools-for-working-with-lists)158  - [Арифметика с плавающей запятой десятичных чисел](https://python-all.ru/3.0/tutorial/stdlib2.html#decimal-floating-point-arithmetic)159- [Что дальше?](https://python-all.ru/3.0/tutorial/whatnow.html)160- [Интерактивное редактирование ввода и подстановка истории](https://python-all.ru/3.0/tutorial/interactive.html)161162  - [Редактирование строки](https://python-all.ru/3.0/tutorial/interactive.html#line-editing)163  - [Подстановка истории](https://python-all.ru/3.0/tutorial/interactive.html#history-substitution)164  - [Привязки клавиш](https://python-all.ru/3.0/tutorial/interactive.html#key-bindings)165  - [Комментарии](https://python-all.ru/3.0/tutorial/interactive.html#commentary)166- [Арифметика с плавающей запятой: проблемы и ограничения](https://python-all.ru/3.0/tutorial/floatingpoint.html)167168  - [Ошибка представления](https://python-all.ru/3.0/tutorial/floatingpoint.html#representation-error)169