https://github.com/viktor-yakubiv/optimize-data
Dictionary optimizer for format method
https://github.com/viktor-yakubiv/optimize-data
Last synced: 2 months ago
JSON representation
Dictionary optimizer for format method
- Host: GitHub
- URL: https://github.com/viktor-yakubiv/optimize-data
- Owner: viktor-yakubiv
- License: mit
- Created: 2017-06-18T21:40:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-18T21:46:52.000Z (almost 8 years ago)
- Last Synced: 2025-02-09T15:33:38.704Z (4 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dict Optimizer
Simple function to optimize dicts for `format()` method.
## Usage
```
template = 'some {formatting} string'
data = {
'formatting': 'amazing',
'redundand': 'data',
}
new_data = optimize_data(template, data)
```Result:
```
new_data = {
'formatting': 'amazing',
}
```Function works correct with _dicts_, _lists_ and custom _objects_.