Bootstrap

python 如何判断数据类型

python 输出与判断数据类型

data = [1,2,3]
print("--->result1:",type(data))

if isinstance(data, list):
    print("--->result2:","true")
else:
    print("--->result2:","false")

--->result1: <class 'list'>
--->result2: true
;