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.0.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: deep_dict_update-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 45332e31620f2c9f0e0ac27b7799770a06c97edca36e9886917ff13fbb111342
MD5 97b246cb2784d1b9feb1e379996a0df3
BLAKE2b-256 d809285e7f27a5bc28d923a3e33621d8edd67562a864b891560aed6a518d1212

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deep_dict_update-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5593b172041d4972d2839425ed9831dcad4645bbec95f49deffb8ae9235f82b2
MD5 d5f809b9ab0efb66a13a966802b71c45
BLAKE2b-256 d9b750f5ff065cf5acc063572b90d058923c16787437738127b177f3b54b9db1

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