the most elegant solutions would be the already proposed,
a=123
bool_a = a.isnumeric()
Unfortunatelly it doesn't work both for negative integers and for general float values of a. If your point is to check if 'a' is a generic number beyond integers i'd suggest the following one, which works for every kind of float and integer :). Here is the test:
def isanumber(a):
try:
float(repr(a))
bool_a = True
except:
bool_a = False
return bool_a
a = 1 # integer
isanumber(a)
>>> True
a = -2.5982347892 # general float
isanumber(a)
>>> True
a = '1' # actually a string
isanumber(a)
>>> False
I hope you find it useful :)