difflib.py 207 B

12345678
  1. def get_close_matches(word, possibilities, n=3, cutoff=0.6):
  2. def fold(s):
  3. return s.lower().replace(" ", "").replace("\t", "")
  4. for p in possibilities:
  5. if fold(p) == fold(word):
  6. return [p]
  7. return []