I have the following dictionary in Python:
dict_a = {"a": 3.55555, "b": 6.66666, "c": "foo"}
I would like to output it to a .json file with rounding up the floats up to 2 decimals:
with open('dict_a.txt', 'w') as json_file:
json.dump(dict_a , json_file)
output:
{"a": 3.55, "b": 6.66, "c": "foo"}
Is that possible using python 3.8 ?