Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

check filed exist in object python

>>> class A(object):
... foo = 1
...
>>> class B(A):
... pass
...
>>> b = B()
>>> hasattr(b, 'foo')
True
>>> 'foo' in b.__dict__
False
Source by www.pythoncentral.io #
 
PREVIOUS NEXT
Tagged: #check #filed #exist #object #python
ADD COMMENT
Topic
Name
5+2 =