Commit 43dc1240 authored by iker_martin's avatar iker_martin
Browse files

Improved the detection of float numbers when creating multiple config files

parent 20e3c28b
...@@ -67,13 +67,16 @@ def convert_to_number(number): ...@@ -67,13 +67,16 @@ def convert_to_number(number):
res = None res = None
try: try:
res = float(number) res = float(number)
if res == int(number):
res = int(number)
except ValueError: except ValueError:
if isinstance(number, str): if isinstance(number, str):
res = number res = number
else: else:
print("Unable to convert to number - Not a fatal error") print("Unable to convert to number - Not a fatal error")
if isinstance(res, float):
try:
res = int(number)
except ValueError:
print("Unable to convert float to int - Not a fatal error")
return res return res
def process_line(line, data): def process_line(line, data):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment