Posted By

magicrebirth on 07/22/11


Tagged

String matching difflib


Versions (?)

Statistical String Comparison


 / Published in: Python
 

URL: http://stackoverflow.com/questions/682367/good-python-modules-for-fuzzy-string-comparison

http://docs.python.org/library/difflib.html

  1. >>> import difflib
  2.  
  3. >>> difflib.SequenceMatcher(None, 'abcde', 'abcde').ratio()
  4. 1.0
  5.  
  6. >>> difflib.SequenceMatcher(None, 'abcde', 'zbcde').ratio()
  7. 0.80000000000000004
  8.  
  9. >>> difflib.SequenceMatcher(None, 'abcde', 'zyzzy').ratio()
  10. 0.0

Report this snippet  

You need to login to post a comment.