Skip to main content

Get element by fuzzy key from dict

Project description

Build Status

Dict extension - get_fuzzy

Get element by fuzzy key from dict.


The library is extension for buildin type dict. After import you can use get_fuzzy and get_fuzzy_stats like get method.

The minimum required python-3.4


This library can be install from pip:

pip install dict-extend-fuzzy


Simple example

from dictextendfuzzy import get_fuzzy

data = {
	'aaaa' : 1,
	'bbbb' : 2

data.get_fuzzy('aaab')  # 1

Get some more information

from dictextendfuzzy import get_fuzzy_stats

data = {
	'aaaa' : 1,
	'bbbb' : 2

obj = data.get_fuzzy_stats('aaab')
obj.key     # 'aaaa'
obj.value   # 1
obj.ratio   # 0.75

With optional parameters

data.get_fuzzy('kei', 'default_object', level=0.5)
data.get_fuzzy_stats('kay', {}, level=0.25)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dict-extend-fuzzy-0.2.2.tar.gz (3.8 kB view hashes)

Uploaded source

Built Distribution

dict_extend_fuzzy-0.2.2-py3-none-any.whl (4.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page