The problem is with the way you're using sm.ratio
. sm.ratio
is a function. To get the value that you're after, try calling it: sm.ratio()
In [77]: sm = difflib.SequenceMatcher(None, "university", "anniversary")
In [78]: sm.ratio
Out[78]: <bound method SequenceMatcher.ratio of <difflib.SequenceMatcher instance at 0x104d00488>>
In [79]: sm.ratio()
Out[79]: 0.6666666666666666