August 2018
Intermediate to advanced
366 pages
10h 14m
English
Perform the following steps for this recipe:
>>> s = 'Today the weather is nice'
>>> s2 = 'Today the weater is nice' >>> s3 = 'Yesterday the weather was nice' >>> s4 = 'Today my dog ate steak'
>>> import difflib >>> difflib.SequenceMatcher(None, s, s2, False).ratio() 0.9795918367346939 >>> difflib.SequenceMatcher(None, s, s3, False).ratio() 0.8 >>> difflib.SequenceMatcher(None, s, s4, False).ratio() 0.46808510638297873
So SequenceMatcher was able to detect that s and s2 are very similar (98%), and apart from a typo in ...