判断object 是否为类classinfo的实例,是返回true
class Student():
def __init__(self,id,name):
self.id=id
self.name=name
def __repr__(self):
return "id="+self.id+", name="+self.name
han=Student(id="a001",name="ahsan")
isinstance(han,Student)
out:
True
网友评论