[Tutor] Variables in workspace

Alan Gauld alan.gauld at btinternet.com
Sat Oct 13 18:30:05 CEST 2007


"Eli Brosh" <ebrosh at nana10.co.il> wrote 

> Now, I want to know which variables are in my workspace.

Try dir()

That should give you the names in the current namespace.
You will see some names you didn't define too.

dir()is a really helpful command when you want to see whats possible.

>>> dir('')

Will list all the methods of a string for example.

>>> import math
>>> dir(math)

will list all the math functions and constants.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld





More information about the Tutor mailing list