libb.is_numeric

is_numeric(txt)[source]

Check if value can be converted to a float.

Parameters:

txt – Value to check.

Returns:

True if value can be converted to float.

Return type:

bool

Warning

Complex types cannot be converted to float.

Example:

>>> is_numeric('a')
False
>>> is_numeric(1e4)
True
>>> is_numeric('1E2')
True
>>> is_numeric(complex(-1,0))
False