| Home | Trees | Indices | Help |
|
|---|
difflib.SequenceMatcher --+ | InsensitiveSequenceMatcher
Inherited from difflib.SequenceMatcher:
__init__,
find_longest_match,
get_grouped_opcodes,
get_opcodes,
quick_ratio,
ratio,
real_quick_ratio,
set_seq1,
set_seq2,
set_seqs
2
'InsensitiveSequenceMatcher'
Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i and in j. New in Python 2.5, it's also guaranteed that if (i, j, n) and (i', j', n') are adjacent triples in the list, and the second is not the last triple in the list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe adjacent equal blocks.
The last triple is a dummy, (len(a), len(b), 0), and is the only triple with n==0.
>>> s = SequenceMatcher(None, "abxcd", "abcd") >>> s.get_matching_blocks() [Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
| Home | Trees | Indices | Help |
|
|---|