Python

Fuzzy string comparison

>>> import difflib
>>> s=difflib.SequenceMatcher(None, "abcd","bcde")
# Return a measure of the sequences’ similarity as a float in the range [0, 1].
# This is 1.0 if the sequences are identical, and 0.0 if they have nothing in common.
>>> print s.ratio()
0.75
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License