diggrtoolbox.deepget package

Submodules

diggrtoolbox.deepget.deepget module

Deepget is a small function enabling the user to “cherrypick” specific values from deeply nested dicts or lists.

Author: Florian Rämisch <raemisch@ub.uni-leipzig.de> Copyright: Universitätsbibliothek Leipzig, 2018 License: GPLv3

diggrtoolbox.deepget.deepget.deepget(obj, keys)[source]

Deepget is a small function enabling the user to “cherrypick” specific values from deeply nested dicts or lists. This is useful, if the just one specific value is needed, which is hidden in multiple hierarchies.

Example:
>>> import diggrtoolbox as dt
>>> ENTRY = {'data' : {'raw': {'key1': 'value1',
                               'key2': 'value2'}}}
>>> KEY2 = ['data', 'raw', 'key2']
>>> dt.deepget(ENTRY, KEY2) == 'value2'
True

Module contents

diggrtoolbox.deepget.deepget(obj, keys)[source]

Deepget is a small function enabling the user to “cherrypick” specific values from deeply nested dicts or lists. This is useful, if the just one specific value is needed, which is hidden in multiple hierarchies.

Example:
>>> import diggrtoolbox as dt
>>> ENTRY = {'data' : {'raw': {'key1': 'value1',
                               'key2': 'value2'}}}
>>> KEY2 = ['data', 'raw', 'key2']
>>> dt.deepget(ENTRY, KEY2) == 'value2'
True