Revolution
Commodore
- Registriert
- März 2008
- Beiträge
- 4.965
Hallo zusammen,
Mir erschließt sich gerade nicht so richtig warum Python mir mit json.loads(jasondata) den wert 0.001000000000000000020816681711721685132943093776702880859375 auf 0.001 kürzt? Kann man das irgendwie verhindern?
Mir erschließt sich gerade nicht so richtig warum Python mir mit json.loads(jasondata) den wert 0.001000000000000000020816681711721685132943093776702880859375 auf 0.001 kürzt? Kann man das irgendwie verhindern?
Code:
if args.output == 'json':
#pd.set_option('precision', 10)
jasondata=(json.dumps(ydata, indent=4, sort_keys=True))
print(jasondata)
pythonObj = json.loads(jasondata)
print(pythonObj)
name = (pythonObj['records'][1]['value'])
print(name)
#print(jasondata['records'][1]['value'])
#print(jasondata)
Code:
root@testpi:/home/****/pyMeterBus/tools# python3 mbus-serial-request-data-multi-reply.py -a 0 /dev/serial0
{
"access_no": 32,
"identification": "23670225",
"manufacturer": "INV",
"medium": 7,
"records": [
{
"unit": "none",
"value": 23670225
},
{
"unit": "m^3",
"value": 0.001000000000000000020816681711721685132943093776702880859375
}
]
}
{'access_no': 32, 'identification': '23670225', 'manufacturer': 'INV', 'medium': 7, 'records': [{'unit': 'none', 'value': 23670225}, {'unit': 'm^3', 'value': 0.001}]}
0.001