Python中查看变量数据类型

内置函数isinstance(object, (type1,type2…))

isinstance('content', str)

返回True or False

使用内置函数type(object)

print(type(1))   
print(type('content'))

输出

<type 'int'>    #返回整形
<type 'str'>    #返回字符串 

你可能感兴趣的:(Python)