Skip to main content

An enhanced dictionary object

Project description

sDict (Supa Dict!)

Installation

Installation can be done via pypi: pip3 install supa-dict

Usage

SDict is an enhanced dictionary object for Python. It has several features and applications especially well suited to use in templating engines. The biggest enhancement is the ability to use dot notation for 'pathing' your data. For example:

>>> from supa_dict import sDict
>>> obj = sDict({'foo': 'bar', 'baz': {'key': 'val'}})
>>> print(obj.baz.key)
'val'
>>>

You can also use the .json, .yaml, and .toml attributes to load and dump data in different formats. For instance with the following json file as ./test.json:

{
  "foo": "bar",
  "baz": {
    "key": "val"
  }
}

You can import the json data using the .json property:

>>> from supa_dict import sDict
>>> obj = sDict()
>>> obj.json = './test.json'
>>> print(obj)
{'foo': 'bar', 'baz': {'key': 'val'}}
>>> print(obj.baz.key)
'val'
>>>

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

supa-dict-0.5.2.tar.gz (2.8 kB view hashes)

Uploaded Source

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