Python判断一个变量值是否为数字数值类型
from numbers import Number
isinstance(x, Number)
下面是源代码中关于Number的描述
class Number(metaclass=ABCMeta): """All numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). """