Skip to main content

No project description provided

Project description

prodot

A new way to deal with dictionaries and lists in python.

install

pip install prodot

Usage

Import the dot object from the prodot library. You can create a new empty dictionary, or start with a filled one

from prodot import DotObject

# No parameters instances an empty dictionary
my_new_obj = DotObject() 

# The Dot Object can be initialized with a dictionary
my_dict_obj = DotObject({"foo":["bar,"eggs"]})

# The Dot Object can also initialize with a list
my_list_obj = DotObject([ [1,2,3], ["a","b","c"], [{"foo":"bar"}, {"bar":"eggs"}] ])

Dot notation usage

By using the dot-object you can use the dictionary as a class

my_json = {
  "userData": {
    "name": "John",
    "age": "38",
    "shoppingCart": [
      {"cellphone": 999.99}
      {"notebook": 2999.99}
      {"wireless keyboard": 299.99}
    ]
  }
}

my_new_obj = DotObject(my_json)

shoppingCart = my_new_obj.userData.shoppingCart

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

prodot-0.1.1.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

prodot-0.1.1-py3-none-any.whl (15.7 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