If you know the type. You should be able to detect it.
from decimal import Decimal from fractions import Fraction NUMBER = (int, float, complex, Decimal, Fraction) def is_number(n): if isinstance(n, NUMBER): print(n, 'is a number') else: print(n, 'is not a number') is_number(1) is_number(1.2) is_number(Decimal(2.02)) is_number(Fraction(2,3)) is_number(1j) is_number('1')
99 percent of computer problems exists between chair and keyboard.