This document is for an old version of Python that is no longer supported. You should upgrade and read the Dokumentasi Python untuk rilis stabil saat ini.

# 7. String Services

The modules described in this chapter provide a wide range of string manipulation operations.

In addition, Python's built-in string classes support the sequence type methods described in the Sequence Types --- str, unicode, list, tuple, bytearray, buffer, xrange section, and also the string-specific methods described in the String Methods section. To output formatted strings use template strings or the `%` operator described in the String Formatting Operations section. Also, see the `re` module for string functions based on regular expressions.

- 7.1. `string` --- Common string operations
  - 7.1.1. String constants
  - 7.1.2. Custom String Formatting
  - 7.1.3. Format String Syntax
    - 7.1.3.1. Format Specification Mini-Language
    - 7.1.3.2. Format examples
  - 7.1.4. Template strings
  - 7.1.5. String functions
  - 7.1.6. Deprecated string functions
- 7.2. `re` --- Regular expression operations
  - 7.2.1. Regular Expression Syntax
  - 7.2.2. Module Contents
  - 7.2.3. Regular Expression Objects
  - 7.2.4. Match Objects
  - 7.2.5. Examples
    - 7.2.5.1. Checking For a Pair
    - 7.2.5.2. Simulating scanf()
    - 7.2.5.3. search() vs. match()
    - 7.2.5.4. Making a Phonebook
    - 7.2.5.5. Text Munging
    - 7.2.5.6. Finding all Adverbs
    - 7.2.5.7. Finding all Adverbs and their Positions
    - 7.2.5.8. Raw String Notation
- 7.3. `struct` --- Interpret strings as packed binary data
  - 7.3.1. Functions and Exceptions
  - 7.3.2. Format Strings
    - 7.3.2.1. Byte Order, Size, and Alignment
    - 7.3.2.2. Format Characters
    - 7.3.2.3. Contoh-contoh
  - 7.3.3. Kelas-kelas
- 7.4. `difflib` --- Helpers for computing deltas
  - 7.4.1. SequenceMatcher Objects
  - 7.4.2. SequenceMatcher Examples
  - 7.4.3. Differ Objects
  - 7.4.4. Differ Example
  - 7.4.5. A command-line interface to difflib
- 7.5. `StringIO` --- Read and write strings as files
- 7.6. `cStringIO` --- Faster version of `StringIO`
- 7.7. `textwrap` --- Text wrapping and filling
- 7.8. `codecs` --- Codec registry and base classes
  - 7.8.1. Codec Base Classes
    - 7.8.1.1. Codec Objects
    - 7.8.1.2. IncrementalEncoder Objects
    - 7.8.1.3. IncrementalDecoder Objects
    - 7.8.1.4. Objek StreamWriter
    - 7.8.1.5. Objek StreamReader
    - 7.8.1.6. Objek StreamReaderWriter
    - 7.8.1.7. Objek StreamRecoder
  - 7.8.2. Encodings and Unicode
  - 7.8.3. Standard Encodings
  - 7.8.4. Python Specific Encodings
  - 7.8.5. `encodings.idna` --- Internationalized Domain Names in Applications
  - 7.8.6. `encodings.utf_8_sig` --- UTF-8 codec with BOM signature
- 7.9. `unicodedata` --- Unicode Database
- 7.10. `stringprep` --- Internet String Preparation
- 7.11. `fpformat` --- Floating point conversions