Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Iker Martín Álvarez
Proteo
Commits
43dc1240
Commit
43dc1240
authored
Jun 04, 2024
by
iker_martin
Browse files
Improved the detection of float numbers when creating multiple config files
parent
20e3c28b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Exec/PythonCodes/read_multiple.py
View file @
43dc1240
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment