difflib

Module difflib – helpers for computing deltas between objects.

Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best “good enough” matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context diff format.
Function ndiff(a, b):
Return a delta: the difference between a and b (lists of strings).
Function restore(delta, which):
Return one of the two sequences that generated an ndiff delta.
Function unified_diff(a, b):
For two lists of strings, return a delta in unified diff format.
Class SequenceMatcher:
A flexible class for comparing pairs of sequences of any type.
Class Differ:
For producing human-readable deltas from sequences of lines of text.
Class HtmlDiff:
For producing HTML side by side comparison with change highlights.

Functions

IS_CHARACTER_JUNK(ch[, ws]) Return 1 for ignorable character: iff ch is a space or tab.
IS_LINE_JUNK(line[, pat]) Return 1 for ignorable line: iff line is blank or contains a single ‘#’.
context_diff(a, b[, fromfile, tofile, ...]) Compare two sequences of lines; generate the delta as a context diff.
get_close_matches(word, possibilities[, n, ...]) Use SequenceMatcher to return list of the best “good enough” matches.
ndiff(a, b[, linejunk, charjunk]) Compare a and b (lists of strings); return a Differ-style delta.
reduce((function, sequence[, initial]) -> value) Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value.
restore(delta, which) Generate one of the two sequences that generated a delta.
unified_diff(a, b[, fromfile, tofile, ...]) Compare two sequences of lines; generate the delta as a unified diff.

Classes

Differ([linejunk, charjunk]) Differ is a class for comparing sequences of lines of text, and producing human-readable differences or deltas.
HtmlDiff([tabsize, wrapcolumn, linejunk, ...]) For producing HTML side by side comparison with change highlights.
Match
SequenceMatcher([isjunk, a, b, autojunk]) SequenceMatcher is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable.