def fuzzy_get_tuple ( dict_obj , approximate_key , dict_keys = None , key_and_value = False , similarity = 0.6 , default = None ) : return fuzzy_get ( dict ( ( '|' . join ( str ( k2 ) for k2 in k ) , v ) for ( k , v ) in viewitems ( dict_obj ) ) , '|' . join ( str ( k ) for k in approximate_key ) , dict_keys = dict_keys , key_and_value = key_and_value , similarity = similarity , default = default )
closest match in dictionary python
Find the closest matching key and / or value in a dictionary ( must have all string keys! )
def fuzzy_get_tuple(dict_obj, approximate_key, dict_keys=None, key_and_value=False, similarity=0.6, default=None):
    """Find the closest matching key and/or value in a dictionary (must have all string keys!)"""
    return fuzzy_get(dict(('|'.join(str(k2) for k2 in k), v) for (k, v) in viewitems(dict_obj)),
                     '|'.join(str(k) for k in approximate_key), dict_keys=dict_keys,
                     key_and_value=key_and_value, similarity=similarity, default=default)