Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

DOD

dod_print

Help on function dod_print in module pydicts.dod:

dod_print(dod_, indent=4, depth=None, width=80, sort_dicts=True)
    Prints a dictionary of dictionaries (DoD) in a human-readable, pretty-printed format.

    Args:
        dod_ (dict): The dictionary of dictionaries to print.
        indent (int, optional): The number of spaces to indent each level. Defaults to 4.
        depth (int, optional): The maximum depth to recurse when pretty-printing.
                               If None, there is no limit. Defaults to None.
        width (int, optional): The maximum desired output width. Defaults to 80.
        sort_dicts (bool, optional): If True, dictionary keys are sorted alphabetically. Defaults to True.

    Returns:
        None

from pydicts import dod
from datetime import date, datetime
from decimal import Decimal
d={"a": datetime.now(), "b": date.today(), "c": Decimal('12.32'), "d": None, "e": int(12), "f":None, "g":True, "h":False,  "nested": {"x":1, "y":2, "z":{"n":4, "m":5, "o":6}}}
dod_={}
dod_["first"]=d
dod_["second"]=d
dod.dod_print(dod_)
{   'first': {   'a': datetime.datetime(2026, 4, 26, 10, 21, 9, 774127),
                 'b': datetime.date(2026, 4, 26),
                 'c': Decimal('12.32'),
                 'd': None,
                 'e': 12,
                 'f': None,
                 'g': True,
                 'h': False,
                 'nested': {'x': 1, 'y': 2, 'z': {'m': 5, 'n': 4, 'o': 6}}},
    'second': {   'a': datetime.datetime(2026, 4, 26, 10, 21, 9, 774127),
                  'b': datetime.date(2026, 4, 26),
                  'c': Decimal('12.32'),
                  'd': None,
                  'e': 12,
                  'f': None,
                  'g': True,
                  'h': False,
                  'nested': {'x': 1, 'y': 2, 'z': {'m': 5, 'n': 4, 'o': 6}}}}