Skip to main content

Awesome module for conver dict to class

Project description

About this project:

  • This project created to convert any dict into class in python :) check github

Install:

  • pip install python-dtoc

Simple example:

  • Print the object :

from pydtoc import dtc

foo = dtc({'str': 'string', 'int': 1, 'list': [1, 2, 3, 4, {'hi': True}]})

print(foo)
  • Output :
{

    "str": "string",

    "int": 1,

    "list": [

        1,

        2,

        3,

        4,

        {

            "hi": true

        }

    ]

}
  • Print key of value :

from pydtoc import dtc

foo = dtc({'str': 'string', 'int': 1, 'list': [1, 2, 3, 4, {'hi': True}]})

print(foo.list[-1].hi)

print(foo.str)
  • Output :

True

string

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

python-dtoc-2023.10.5.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

python_dtoc-2023.10.5-py3-none-any.whl (3.0 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