How to get the list of imported variables/functions

Michael Hudson mwh21 at cam.ac.uk
Wed May 3 06:07:58 EDT 2000


"Emile van Sebille" <emile at fenx.com> writes:

> Well, I got this to work:
> 
> a = dir(sys.modules['imported_mod'])
> 
> then filter as needed.
> 
> I couldn't get the keys attribute of the module though. Should
> I have been able to?
> 
> filter(lambda s:s[1]<>'_',sys.module['imported_mod'].__dict__.keys())

Ack, surse me for a fool; I meant

filter(lambda s:s[1]<>'_',sys.modules['imported_mod'].__dict__.keys())

(I've even tested it this time!)

M.

-- 
8. A programming language is low level when its programs require
   attention to the irrelevant.
     -- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html



More information about the Python-list mailing list