Spaces:
Running
Running
File size: 702 Bytes
91796e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from functools import cache
def convert_keys_to_lowercase(input_dict):
return {key.lower(): value for key, value in input_dict.items()}
def match_in_keys(dictionary, search_string):
lowercase_dict = convert_keys_to_lowercase(dictionary)
if search_string.lower() in list(lowercase_dict.keys()):
return lowercase_dict.get(search_string.lower())
for l_key in lowercase_dict.keys():
if l_key.startswith(search_string.lower()):
return lowercase_dict.get(l_key)
def match_in_values(dictionary, search_string):
lowercase_dict = convert_keys_to_lowercase(dictionary)
if search_string.lower() in list(lowercase_dict.values()):
return search_string |