On Mar 6, 1:14 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> 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'?
>
> I hope my question is clear.
> Thanks

If you had posted actual working code, "Class" would be all lower case
("class").  But we get the drift (in general, though, when posting
questions about examples from your code, best to copy-paste the actual
code, not a paraphrasing of it):

print Sample.__dict__.keys()

prints:

['__module__', 'fullname', '__doc__']


-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to