How/where to store calibration values - written by program A, read by program B

Barry Scott barry at barrys-emacs.org
Tue Dec 5 15:45:36 EST 2023



> On 5 Dec 2023, at 14:37, Chris Green via Python-list <python-list at python.org> wrote:
> 
> Are there any Python modules aimed specifically at this sort of
> requirement?

I tend to use JSON for this type of thing.
Suggest that you use the options to pretty print the json that is saved so that a human can read it.

For example:
----
import json

config = {
    'key2': 42,
    'key1': 'value 1',
}

print(json.dumps(config, indent=4, separators=(', ', ': '), sort_keys=True))

----
% python $T/a.py
{
    "key1": "value 1",
    "key2": 42
}

Barry



More information about the Python-list mailing list