strings.md
1> **Источник:** https://python-all.ru/2.7/library/strings.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# 7. Строковые службы89The modules described in this chapter provide a wide range of string manipulation operations.1011Кроме того, встроенные строковые классы Python поддерживают методы последовательностей, описанные в разделе [Типы последовательностей – str, unicode, list, tuple, bytearray, buffer, xrange](https://python-all.ru/2.7/library/stdtypes.html#typesseq), а также строковые методы, описанные в разделе [Строковые методы](https://python-all.ru/2.7/library/stdtypes.html#string-methods). Для вывода форматированных строк используйте шаблонные строки или оператор `%`, описанный в разделе [Операции форматирования строк](https://python-all.ru/2.7/library/stdtypes.html#string-formatting). Также смотрите модуль [`re`](https://python-all.ru/2.7/library/re.html#module-re) для строковых функций на основе регулярных выражений.1213- [7.1. `string` – Общие операции со строками](https://python-all.ru/2.7/library/string.html)1415 - [7.1.1. Константы строк](https://python-all.ru/2.7/library/string.html#string-constants)16 - [7.1.2. Пользовательское форматирование строк](https://python-all.ru/2.7/library/string.html#custom-string-formatting)17 - [7.1.3. Синтаксис строк форматирования](https://python-all.ru/2.7/library/string.html#format-string-syntax)1819 - [7.1.3.1. Мини-язык спецификации форматирования](https://python-all.ru/2.7/library/string.html#format-specification-mini-language)20 - [7.1.3.2. Примеры форматирования](https://python-all.ru/2.7/library/string.html#format-examples)21 - [7.1.4. Шаблонные строки](https://python-all.ru/2.7/library/string.html#template-strings)22 - [7.1.5. Строковые функции](https://python-all.ru/2.7/library/string.html#string-functions)23 - [7.1.6. Устаревшие строковые функции](https://python-all.ru/2.7/library/string.html#deprecated-string-functions)24- [7.2. `re` – Операции с регулярными выражениями](https://python-all.ru/2.7/library/re.html)2526 - [7.2.1. Синтаксис регулярных выражений](https://python-all.ru/2.7/library/re.html#regular-expression-syntax)27 - [7.2.2. Содержимое модуля](https://python-all.ru/2.7/library/re.html#module-contents)28 - [7.2.3. Объекты регулярных выражений](https://python-all.ru/2.7/library/re.html#regular-expression-objects)29 - [7.2.4. Объекты совпадений](https://python-all.ru/2.7/library/re.html#match-objects)30 - [7.2.5. Примеры](https://python-all.ru/2.7/library/re.html#examples)3132 - [7.2.5.1. Проверка пары](https://python-all.ru/2.7/library/re.html#checking-for-a-pair)33 - [7.2.5.2. Имитация scanf()](https://python-all.ru/2.7/library/re.html#simulating-scanf)34 - [7.2.5.3. search() и match()](https://python-all.ru/2.7/library/re.html#search-vs-match)35 - [7.2.5.4. Создание телефонной книги](https://python-all.ru/2.7/library/re.html#making-a-phonebook)36 - [7.2.5.5. Обработка текста](https://python-all.ru/2.7/library/re.html#text-munging)37 - [7.2.5.6. Поиск всех наречий](https://python-all.ru/2.7/library/re.html#finding-all-adverbs)38 - [7.2.5.7. Поиск всех наречий и их позиций](https://python-all.ru/2.7/library/re.html#finding-all-adverbs-and-their-positions)39 - [7.2.5.8. Сырые строки](https://python-all.ru/2.7/library/re.html#raw-string-notation)40- [7.3. `struct` – Интерпретация строк как упакованных двоичных данных](https://python-all.ru/2.7/library/struct.html)4142 - [7.3.1. Функции и исключения](https://python-all.ru/2.7/library/struct.html#functions-and-exceptions)43 - [7.3.2. Строки формата](https://python-all.ru/2.7/library/struct.html#format-strings)4445 - [7.3.2.1. Порядок байтов, размер и выравнивание](https://python-all.ru/2.7/library/struct.html#byte-order-size-and-alignment)46 - [7.3.2.2. Символы формата](https://python-all.ru/2.7/library/struct.html#format-characters)47 - [7.3.2.3. Примеры](https://python-all.ru/2.7/library/struct.html#examples)48 - [7.3.3. Классы](https://python-all.ru/2.7/library/struct.html#classes)49- [7.4. `difflib` – Вспомогательные функции для вычисления дельт](https://python-all.ru/2.7/library/difflib.html)5051 - [7.4.1. Объекты SequenceMatcher](https://python-all.ru/2.7/library/difflib.html#sequencematcher-objects)52 - [7.4.2. Примеры SequenceMatcher](https://python-all.ru/2.7/library/difflib.html#sequencematcher-examples)53 - [7.4.3. Объекты Differ](https://python-all.ru/2.7/library/difflib.html#differ-objects)54 - [7.4.4. Пример Differ](https://python-all.ru/2.7/library/difflib.html#differ-example)55 - [7.4.5. Интерфейс командной строки для difflib](https://python-all.ru/2.7/library/difflib.html#a-command-line-interface-to-difflib)56- [7.5. `StringIO` – Чтение и запись строк как файлов](https://python-all.ru/2.7/library/stringio.html)57- [7.6. `cStringIO` – Более быстрая версия `StringIO`](https://python-all.ru/2.7/library/stringio.html#module-cStringIO)58- [7.7. `textwrap` – Перенос и заполнение текста](https://python-all.ru/2.7/library/textwrap.html)59- [7.8. `codecs` – Реестр кодеков и базовые классы](https://python-all.ru/2.7/library/codecs.html)6061 - [7.8.1. Базовые классы кодеков](https://python-all.ru/2.7/library/codecs.html#codec-base-classes)6263 - [7.8.1.1. Объекты кодеков](https://python-all.ru/2.7/library/codecs.html#codec-objects)64 - [7.8.1.2. Объекты IncrementalEncoder](https://python-all.ru/2.7/library/codecs.html#incrementalencoder-objects)65 - [7.8.1.3. Объекты IncrementalDecoder](https://python-all.ru/2.7/library/codecs.html#incrementaldecoder-objects)66 - [7.8.1.4. Объекты StreamWriter](https://python-all.ru/2.7/library/codecs.html#streamwriter-objects)67 - [7.8.1.5. Объекты StreamReader](https://python-all.ru/2.7/library/codecs.html#streamreader-objects)68 - [7.8.1.6. Объекты StreamReaderWriter](https://python-all.ru/2.7/library/codecs.html#streamreaderwriter-objects)69 - [7.8.1.7. Объекты StreamRecoder](https://python-all.ru/2.7/library/codecs.html#streamrecoder-objects)70 - [7.8.2. Кодировки и Unicode](https://python-all.ru/2.7/library/codecs.html#encodings-and-unicode)71 - [7.8.3. Стандартные кодировки](https://python-all.ru/2.7/library/codecs.html#standard-encodings)72 - [7.8.4. Специфические для Python кодировки](https://python-all.ru/2.7/library/codecs.html#python-specific-encodings)73 - [7.8.5. `encodings.idna` – Интернационализированные доменные имена в приложениях](https://python-all.ru/2.7/library/codecs.html#module-encodings.idna)74 - [7.8.6. `encodings.utf_8_sig` – Кодек UTF-8 с сигнатурой BOM](https://python-all.ru/2.7/library/codecs.html#module-encodings.utf_8_sig)75- [7.9. `unicodedata` – База данных Unicode](https://python-all.ru/2.7/library/unicodedata.html)76- [7.10. `stringprep` – Подготовка интернет-строк](https://python-all.ru/2.7/library/stringprep.html)77- [7.11. `fpformat` – Преобразования чисел с плавающей точкой](https://python-all.ru/2.7/library/fpformat.html)78