helper.numbers

Numbers


source

is_number

 is_number (x:Union[float,int,complex,str])

*Return True if the input x represents a number.

This function is different from Python’s built-in is_numeric function, which returns True when all characters of a string are digits.*

assert is_number("3.45")
assert is_number(1 + 5j)
assert is_number(5)
assert is_number(0.0)
assert not is_number("3.43.55")
assert not is_number("hie")
assert not is_number("[^1]")
assert not is_number(None)