Exploring Attributes and Methods

Terry Reedy tjreedy at udel.edu
Thu Mar 6 14:30:09 EST 2008


<keios.titan at gmail.com> wrote in message 
news:6018ff8f-3372-42c2-9a2e-5ca996744d5b at e6g2000prf.googlegroups.com...
| Hi,
| Is there a python command that allows me to extract the names (not
| values) of the attributes of a class.
|
| example
|
| Class Sample:
|    fullname = 'Something'
|
| How can I know that this class has an attribute called 'fullname'?

>>> class C: a = 1

>>> dir(C)
['__doc__', '__module__', 'a'] 






More information about the Python-list mailing list