If you want to confirm whether a variable is a number without caring whether it is a float or an integer, numbers. Number is what you can use to check.
This is a built-in Python library. Try it out if you are looking for something similar.
Link to the source code.