))Hi all, I would like to find the closest match between two string variables using difflib, this is my case...
varA = 'plainmountain'
varB = 'skymountain'
newVarA = 'piaimauntain'
I would like to difflib to find the closest match in VarA and VarB variables (they are just variables, not a list), what if I add a third variable varC
in the search??? How could I get difflib to find a single closest match.
Currently Im trying this...
varA = 'plaimountain'
varB = 'skymountain'
varAll = [varA, varB, varC]
newVarA = 'piaimauntain'
I was doint it this way...
import difflib
d = difflib.Differ()
diff = d.compare(varA, newVarA)
print '\n'.join(diff)
Now Im doing it this way...
from difflib import SequenceMatcher
result = difflib.get_close_matches(newVarA, varAll, 1, 0.7)
print result
Thanks Advanced.