isinstance(): 判断一个对象是否是由一个类创建出来的,是则返回True,否则返回False
语法:isinstance(对象,类)
s = 'hello' class Demo(object): pass demo = Demo() print(isinstance(demo,Demo)) # True print(isinstance(s,Demo)) # False