getting object instead of string from dir()

Rominsky john.rominsky at gmail.com
Wed Dec 17 18:16:35 CET 2008


I am trying to use dir to generate a list of methods, variables, etc.
I would like to be able to go through the list and seperate the
objects by type using the type() command, but the dir command returns
a list of strings.  When I ask for the type of an element, the answer
is always string.  How do I point at the variables themselves.  A
quick example is:

a = 5
b = 2.0
c = 'c'

lst = dir()

for el in lst:
    print type(el)

Right now I am understandably getting all types being output as
strings, how do i get the type of the actual objects returned from dir
()?



More information about the Python-list mailing list