Text Processing Services¶
The modules described in this chapter provide a wide range of string manipulation operations and other text processing services.
The codecs
module described under Binary Data Services is also
highly relevant to text processing. In addition, see the documentation for
Python’s built-in string type in Text Sequence Type — str.
string
— Common string operationsre
— Regular expression operationsdifflib
— Helpers for computing deltasDiffer
HtmlDiff
context_diff()
get_close_matches()
ndiff()
restore()
unified_diff()
diff_bytes()
IS_LINE_JUNK()
IS_CHARACTER_JUNK()
- SequenceMatcher Objects
SequenceMatcher
SequenceMatcher.set_seqs()
SequenceMatcher.set_seq1()
SequenceMatcher.set_seq2()
SequenceMatcher.find_longest_match()
SequenceMatcher.get_matching_blocks()
SequenceMatcher.get_opcodes()
SequenceMatcher.get_grouped_opcodes()
SequenceMatcher.ratio()
SequenceMatcher.quick_ratio()
SequenceMatcher.real_quick_ratio()
- SequenceMatcher Examples
- Differ Objects
- Differ Example
- A command-line interface to difflib
textwrap
— Text wrapping and fillingwrap()
fill()
shorten()
dedent()
indent()
TextWrapper
TextWrapper.width
TextWrapper.expand_tabs
TextWrapper.tabsize
TextWrapper.replace_whitespace
TextWrapper.drop_whitespace
TextWrapper.initial_indent
TextWrapper.subsequent_indent
TextWrapper.fix_sentence_endings
TextWrapper.break_long_words
TextWrapper.break_on_hyphens
TextWrapper.max_lines
TextWrapper.placeholder
TextWrapper.wrap()
TextWrapper.fill()
unicodedata
— Unicode Databasestringprep
— Internet String Preparationreadline
— GNU readline interfacerlcompleter
— Completion function for GNU readline