python中 isinstance()和 issubclass()
作者:互联网
1、isintance(a,A) 判断a是否是A的对象
class A():
pass
a = A()
print(isinstance(a,A))
2、issubclass(sub,supper)检查 sub是不是supper的派生类,也就是sub是不是supper的子类
class A():
pass
class B(A):
pass
print(issubclass(B,A))
标签:sub,python,supper,issubclass,pass,print,isinstance,class 来源: https://www.cnblogs.com/Haier123/p/15584482.html