Exploring Attributes and Methods

keios.titan at gmail.com keios.titan at gmail.com
Thu Mar 6 14:41:57 EST 2008


On Mar 7, 12:30 am, "Terry Reedy" <tjre... at udel.edu> wrote:
> <keios.ti... 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']

Thank You



More information about the Python-list mailing list