考虑所有单词小写,Python在列表中搜索匹配项

时间:2015-07-15 13:41:26

标签: python string list dictionary

我需要在python列表中搜索单词的匹配项。我必须首先将单词和列表中的所有单词都转换为小写

def check_match(word,words_dict):
    for w in words_dict:
        if(word.lower()==w.lower()):
            return 1
    return 0

0 个答案:

没有答案