Method signature:
find_longest_match(alo, ahi, blo, bhi)
Parameters:
alo: Search start position in sequence1
ahi: Search stop position in sequence1
blo: Search start position in sequence2
bhi: Search stop position in sequence2
Return value:
Returns a difflib.Match object. The attribute,
difflib.Match.a - contains the starting position of the common block in the first sequence.
difflib.Match.b - contains the starting position of the common block in the second sequence.
difflib.Match.size - contains the length of the common block.
Overview:
Given two sequences that are to be compared, the method find_longest_match() of the SequenceMatcher class in Python, finds the longest matching block that is present in both the sequences. The method returns an object that contains the start positions of the common largest block in the sequence1 and sequence2, along with the length.
Example:
|
# Example Python program that finds the longest # Create an SequenceMatcher object # Set the sequences to be compared # Find the longest matching block print(type(matched)) |
Output:
|
Match(a=0, b=3, size=7) |