Answers for "python verifier qu'un string est un chiffre"

0

python verifier qu'un string est un chiffre

def is_number(s):
    try:
        float(s)
        return True
    except ValueError:
        return False

print(is_number(3)) # True
print(is_number("ok")) # False
print(is_number("32")) # True
Posted by: Guest on April-12-2020
0

python verifier qu'un string est un chiffre

var = input()
try:
    var = int(var)
except ValueError:
    pass
Posted by: Guest on April-12-2020

Code answers related to "python verifier qu'un string est un chiffre"

Python Answers by Framework

Browse Popular Code Answers by Language