6. 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, bytes, bytearray, list, tuple, range section, and also the string-specific methods
described in the String Methods section. To output formatted strings,
see the String Formatting section. Also, see the re module for
string functions based on regular expressions.
- 6.1.
string— Common string operations - 6.2.
re— Regular expression operations- 6.2.1. Regular Expression Syntax
- 6.2.2. Matching vs Searching
- 6.2.3. Module Contents
- 6.2.4. Regular Expression Objects
- 6.2.5. Match Objects
- 6.2.6. Regular Expression Examples
- 6.2.6.1. Checking For a Pair
- 6.2.6.2. Simulating scanf()
- 6.2.6.3. Avoiding recursion
- 6.2.6.4. search() vs. match()
- 6.2.6.5. Making a Phonebook
- 6.2.6.6. Text Munging
- 6.2.6.7. Finding all Adverbs
- 6.2.6.8. Finding all Adverbs and their Positions
- 6.2.6.9. Raw String Notation
- 6.2.6.10. Writing a Tokenizer
- 6.3.
struct— Interpret bytes as packed binary data - 6.4.
difflib— Helpers for computing deltas - 6.5.
textwrap— Text wrapping and filling - 6.6.
codecs— Codec registry and base classes - 6.7.
unicodedata— Unicode Database - 6.8.
stringprep— Internet String Preparation