Skip to main content

Recursively update nested dictionaries with another dictionary

Project description

deep-dict-update

A Python package for recursively updating nested dictionaries with the content of another dictionary.

Installation

You can install dict-update via pip:

pip install dict-update

Usage

from dict_update import dict_update

orig_dict = {
    'a': {
        'b': 2,
        'c': {
            'd': 3
        }
    }
}

new_dict = {
    'a': {
        'c': {
            'e': 4
        },
        'f': 5
    },
    'g': 6
}

updated_dict = dict_update(orig_dict, new_dict)
print(updated_dict)

Output

{
    'a': {
        'b': 2,
        'c': {
            'd': 3,
            'e': 4
        },
        'f': 5
    },
    'g': 6
}

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

deep_dict_update-0.1.1.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

deep_dict_update-0.1.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file deep_dict_update-0.1.1.tar.gz.

File metadata

  • Download URL: deep_dict_update-0.1.1.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.8 Darwin/22.5.0

File hashes

Hashes for deep_dict_update-0.1.1.tar.gz
Algorithm Hash digest
SHA256 81a97faf17322dbbee983b776b23bc2025df49f615eb1c6c9c0b59b0fdde6bf8
MD5 aa000e92e60bfe758d92f7b6e6b8ca81
BLAKE2b-256 95ca71cf72e5120b7d17af3856adb3fd679720c6e14bbc5876c0fdc88e6f9b7c

See more details on using hashes here.

File details

Details for the file deep_dict_update-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for deep_dict_update-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8aafffb2e7674478fdf00cb4403812c2ee1ed39d25d4f8fd63e42d83dbb85ce
MD5 115c8585694531f0bcdca5f8a6faf55a
BLAKE2b-256 d4595dec355967ced16056616e51c6ccfd68e051fd94ca1d24a22409e3c07559

See more details on using hashes here.

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