1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

use try/except and add support for floats in process()

This commit is contained in:
Kelly Brazil
2020-07-09 14:26:35 -07:00
parent 27b21b2faf
commit d112ee94d0

View File

@ -76,10 +76,14 @@ def process(proc_data):
} }
] ]
""" """
for key, value in proc_data.items(): for key in proc_data:
if value.isdigit(): try:
value = int(value) proc_data[key] = int(proc_data[key])
proc_data[key] = value except (ValueError):
try:
proc_data[key] = float(proc_data[key])
except (ValueError):
pass
return proc_data return proc_data