class Person:
def PrintName(self):
print 'Is a Person'
def PrintHello(self):
print 'Hello, world'
per = Person()
per.PrintName()
print hasattr(per,'PrintName')#True
class Person:
def PrintName(self):
print 'Is a Person'
def PrintHello(self):
print 'Hello, world'
per = Person()
per.PrintName()
print hasattr(per,'PrintName')#True
转载于:https://www.cnblogs.com/Alexander11/p/4156199.html