Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python check if string is a float

def isfloat(num):
    try:
        float(num)
        return True
    except ValueError:
        return False

print(isfloat('s12'))
print(isfloat('1.123'))
 
PREVIOUS NEXT
Tagged: #python #check #string #float
ADD COMMENT
Topic
Name
1+6 =