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 deep-dict-update via pip:

pip install deep-dict-update

Usage

from deep_dict_update import deep_dict_update

orig_dict = {
    'data': [
        {'id': 1, 'name': 'Alice'},
        {'id': 2, 'name': 'Bob'}
    ]
}

new_dict = {
    'data': [
        {'id': 3, 'name': 'Charlie'},
        {'id': 4, 'name': 'David'}
    ]
}

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

Output

{
    'data': [
        {'id': 3, 'name': 'Charlie'},
        {'id': 4, 'name': 'David'}
    ]
}

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.6.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

deep_dict_update-0.1.6-py3-none-any.whl (3.4 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