getting dir(x), but not as list of strings?
akeppke at web.de
akeppke at web.de
Wed May 21 06:24:31 EDT 2008
Use
for i in dir(x):
print i # name of member as string
print getattr(x, i) # member
regards
Arno
On 21 Mai, 09:54, m... at pixar.com wrote:
> I want to iterate over members of a module, something like:
>
> for i in dir(x):
> if type(i) == types.FunctionType: ...
>
> but of course dir() returns a list of strings. If x is a module,
> how can I get the list of its members as their actual types?
>
> Many TIA!
> Mark
More information about the Python-list
mailing list