举例:
d = (1,2,3) print(isinstance(d,int)) #False print(isinstance(d,tuple)) #True print(isinstance(d,(int,float,tuple))) #True print(type(d)) #type函数输出数据类型 #<class 'tuple'> print(isinstance(d,type(d))) #此输出恒为true #True
举例:
d = (1,2,3) print(isinstance(d,int)) #False print(isinstance(d,tuple)) #True print(isinstance(d,(int,float,tuple))) #True print(type(d)) #type函数输出数据类型 #<class 'tuple'> print(isinstance(d,type(d))) #此输出恒为true #True