1、type
type(5) 会得到 int
type('5') 会得到 str
type(ture) 会得到 bool
type(5.2) 会得到 float
type(5.2e12) 会得到 float
2、isinstance
isinstance(5,int) 输出 ture
isinstance(5,str) 输出 false
备注:优先选用isinstance
type(5) 会得到 int
type('5') 会得到 str
type(ture) 会得到 bool
type(5.2) 会得到 float
type(5.2e12) 会得到 float
isinstance(5,int) 输出 ture
isinstance(5,str) 输出 false
备注:优先选用isinstance