[Tutor] ?????
Christian Witts
cwitts at compuscan.co.za
Mon May 25 15:07:28 CEST 2009
prasad rao wrote:
>
>
> >for attrib in dir(sys):
> > if callable('sys.%s' % attrib):
> >print 'Callable: sys.%s' % attrib
> > else:
> >print 'Not Callable: sys.%s' % attrib
>
> Any particular reason why you need to be able to do this, just
> wondering about the use case for such automation ?
>
> --
> Kind Regards,
> Christian Witts
>
>
>
> Hello
> It is printing wether the item is callable or not.
> I want it to print
> sys.getdefaultencoding
> ASCII
> sys.getfilesystemencoding
> mbcs
>
> Like that
>
> Prasad
>
>
My apologies, didn't double check.
It should be:
for attrib in dir(sys):
if callable(sys.__getattribute__(attrib)):
print 'Callable: sys.%s' % attrib)
else:
print 'Not Callable: sys.%s' % attrib
--
Kind Regards,
Christian Witts
Data Management
C o m p u s c a n | Confidence in Credit
Telephone: +27 21 888 6000
National Cell Centre: 0861 51 41 31
Fax: +27 21 413 2424
E-mail: cwitts at compuscan.co.za
NOTE: This e-mail (including attachments )is subject to the disclaimer published at: http://www.compuscan.co.za/live/content.php?Item_ID=494.
If you cannot access the disclaimer, request it from email.disclaimer at compuscan.co.za or 0861 514131.
More information about the Tutor
mailing list