📜  get_close_matches - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:44.954000             🧑  作者: Mango

代码示例1
# Function to find all close matches of
# input string in given list of possible strings
from difflib import get_close_matches

def closeMatches(patterns, word):
    print(get_close_matches(word, patterns))

# Driver program
if __name__ == "__main__":
    word = 'appel'
    patterns = ['ape', 'apple', 'peach', 'puppy']
    closeMatches(patterns, word)