ben+python at benfinney.id.au
Sun Oct 25 12:08:56 CET 2009
vsoler <vicente.soler at gmail.com> writes:
> At the prompt:
> import test
> I would like to see the variables created in the test namespace.
> However, variable "a" does not appear in the list, only "test". Since
> I know that var "a" is reachable from the prompt by means of test.a,
> how can I list this sort of variables?
Help on built-in function dir in module __builtin__:
dir([object]) -> list of strings
Return an alphabetized list of names comprising (some of) the
of the given object, and of attributes reachable from it:
No argument: the names in the current scope.
Module object: the module attributes.
So ‘dir()’ returns the names in the current scope, which is why the
names in the module ‘test’ don't appear there.
\ “What I have to do is see, at any rate, that I do not lend |
`\ myself to the wrong which I condemn.” —Henry Thoreau, _Civil |
_o__) Disobedience_ |
More information about the Python-list