New Feature (finding occurence) - typo correction

This commit is contained in:
Ramesh RV 2018-10-08 16:26:29 +05:30
parent 904a2b957d
commit 7692fc2754
4 changed files with 36 additions and 36 deletions

View file

@ -8,7 +8,7 @@ A small Python library which enables:
#. key lookups on deeply nested documents.
#. fetching all keys from a nested dictionary.
#. get the number of occurances of a key/value from a nested dictionary
#. get the number of occurences of a key/value from a nested dictionary
Documents may be built out of dictionaries (dicts) and/or lists.
@ -51,12 +51,12 @@ quick tutorial
>>> get_all_keys(document)
['taco', 'salsa', 'burrito', 'taco']
>>> from nested_lookup import get_occurance_of_key, get_occurance_of_value
>>> from nested_lookup import get_occurence_of_key, get_occurence_of_value
>>> get_occurance_of_key(document, key='taco')
>>> get_occurence_of_key(document, key='taco')
2
>>> get_occurance_of_value(document, value='42')
>>> get_occurence_of_value(document, value='42')
1
longer tutorial
@ -102,19 +102,19 @@ To get a list of every nested key in a document, run this:
['name', 'email_address', 'other', 'secondary_email', 'EMAIL_RECOVERY', 'email_address']
To get the number of occurance of the given key/value
To get the number of occurence of the given key/value
.. code-block:: python
from nested_lookup import get_occurance_of_key, get_occurance_of_value
from nested_lookup import get_occurence_of_key, get_occurence_of_value
no_of_key_occurance = get_occurance_of_key(my_document, key='email_address')
no_of_key_occurence = get_occurence_of_key(my_document, key='email_address')
print(no_of_key_occurance) # result => 2
print(no_of_key_occurence) # result => 2
no_of_value_occurance = get_occurance_of_value(my_document, value='test2@example.com')
no_of_value_occurence = get_occurence_of_value(my_document, value='test2@example.com')
print(no_of_value_occurance) # result => 1
print(no_of_value_occurence) # result => 1
Next, we could act `wild` and find all the email addresses like this: