Skip to content

ItIs

Tools for determining something.

is_number(value)

Check if a string is a number.

Only decimal numbers.

Parameters:

Name Type Description Default
value str

Some kind of string.

required

Returns:

Type Description
bool

True, if the string is a number.

Source code in src\xloft\itis.py
def is_number(value: str) -> bool:
    """Check if a string is a number.

    Only decimal numbers.

    Args:
        value: Some kind of string.

    Returns:
        True, if the string is a number.
    """
    try:
        float(value)
        return True
    except ValueError:
        return False