[Tutor] Getting import to use a variable name

Jim Mooney Py3.4.3winXP cybervigilante at gmail.com
Thu May 21 21:52:44 CEST 2015


On 20 May 2015 at 01:02, Peter Otten <__peter__ at web.de> wrote:

> If you start with an object dir() gives you a list of attribute names. To
> get the actual attributes use
>
> attribute = getattr(object, attribute_name)
>
> Then print the attributes' docstring with
>
> print(attribute_name, attribute.__doc__)
>

Thanks. That will save a lot of scrolling - and saving scrolling and typing
is half the battle ;')

-- 
Jim


More information about the Tutor mailing list