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 details)

Uploaded Source

File details

Details for the file supa-dict-0.5.2.tar.gz.

File metadata

  • Download URL: supa-dict-0.5.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for supa-dict-0.5.2.tar.gz
Algorithm Hash digest
SHA256 ed393f1636bb49ad11e9c795499485169cb7d15132bd2f96fcd9504391bb0d04
MD5 588f24f844d95f70ec8eb371cefe5ae7
BLAKE2b-256 7676a236fdaca0b115344bc8bee07a3d7a2b530dbdf21c729d619245414437ab

See more details on using hashes here.

Supported by

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