On 30 April 2012 23:25, Comer Duncan <[email protected]> wrote:
> Hi,
>
> I have a newbie type question. Say I have started a python (or
> ipython) session and have done some imports and have also defined some
> new variables since the session started. So, I have in my current
> namespace a bunch of things. Suppose I want to list just those
> variable names which have been defined since the session started but
> not include the names of the objects that who and whos will return.
> How to do that?
Not entirely sure, but something like this might work (untested):
for name in dir():
myvalue = eval(name)
print name, "is", type(name), "and is equal to ", myvalue
There's also global(), local() and vars().
--
best regards,
Robert S.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor