T
thinke365
for example, i may define a python class:
class A:
def sayHello():
print 'hello'
a = A()
a.attr1 = 'hello'
a.attr2 = 'bb'
b = A()
a.attr2 = 'aa'
how can i know whether an object have an attribute named attr1?
class A:
def sayHello():
print 'hello'
a = A()
a.attr1 = 'hello'
a.attr2 = 'bb'
b = A()
a.attr2 = 'aa'
how can i know whether an object have an attribute named attr1?