Skip to main content

Convert dictionaries into objects with attribute-style access.

Project description

DictToObject

DictToObject is a Python utility class that converts dictionaries into objects, allowing you to access keys as attributes.

Installation

Install using pip:

pip install dicttoobject

Dependencies

  • termcolor: python

Example

  1. Import the DictToObject class:
from dicttoobject import DictToObject
  1. Create a dictionary:
data = {
    'name': 'John Doe',
    'age': 30,
    'address': {
        'street': '123 Main St',
        'city': 'New York'
    }
}
  1. Convert the dictionary into an object:
obj = DictToObject(data)

# Accessing attributes
print(obj.name)  # Output: John Doe
print(obj.age)  # Output: 30

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

dtob-1.1.2.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dtob-1.1.2-py3-none-any.whl (1.8 kB view details)

Uploaded Python 3

File details

Details for the file dtob-1.1.2.tar.gz.

File metadata

  • Download URL: dtob-1.1.2.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for dtob-1.1.2.tar.gz
Algorithm Hash digest
SHA256 108b40f92813a6a5963dfefa03df3221f3c6c363c23e4cd072d2f13df1a796c2
MD5 9d0e25614ecc89b179e3181c5b8696f4
BLAKE2b-256 19e8f4015f0de7c3d4a859c4486e3ac1914a9a8180afaa6595bff81ee7c00837

See more details on using hashes here.

File details

Details for the file dtob-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: dtob-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for dtob-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 52b459507f025da1c8dbbc82374cdee9d9a96ec97ce5f764b361e74cd14d2dc4
MD5 9805640946754d887402ecb80bad60e4
BLAKE2b-256 43f7567986f1670a15f88f500d3fe991282929759c393721b4690df345bacb83

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