Skip to main content

No project description provided

Project description

dict dig utils

Some functionality would be quite comfortable to manipulate dicts, and that we do not have to write them all the time. Perhaps they already exist, but for any case, here is a simple version of them for myself.

flattening

First thing is to turn keys into a flattened string, like

  • key1
    • key2
      • key3

turns to key1/key2/key3 Then texts can be easily searched in keys and values withuot transversing the whole structure

display

a simple printing function that indents with the levels of the dict may be intuitive to see what is in a dict.

search for a key

within the whole tree, and return whatever element is found under it in a list, allowing for multiple keys. It searches text in the key, thus using the in operator.

list keys

run through recursively, and give a list of keys from within. This is useful for complex, deep dict trees, when one has no idea where to find a specific key, or how it is spelled.

redisplay depth

after coming back from a deeper dict, display the current depth again

lists

use lists as lists with a serial index along enumerate of the list in dict_disp()

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

dictDigUtils-1.0.3.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

dictDigUtils-1.0.3-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page