def is_number(s, cast=float):
    try:
        cast(s) # for int, long and float
    except ValueError:
        return False

    return True
Check if a string is a number. Use cast=int to check if s is an integer.
dataset/ETHPy150Open tanghaibao/jcvi/formats/base.py/is_number