Ты можешь использовать parseo и исключения
# x="-0.5y"
# x="-3.4"
# x="2.0"
try:
print int(x)
# Es entero
except ValueError:
try:
print float(x)
# Es decimal flotante
except ValueError:
print 'No es un numero'
ответ дан
Ceragos
10.11.2019, 22:23
Ссылка