mat...@gmail.com wrote: >>>> for i in dir() : > ... t = eval( 'type(' + i + ')' ) > ... if re.match('.*module.*',str(t)) : print i, t > ...
If you think you need eval stop and think again. You don't. If you think you need regular expressions stop and think again. You usually don't. >>> def imported(namespace=None): from types import ModuleType if namespace is None: namespace = globals() for n, v in namespace.iteritems(): if isinstance(v, ModuleType): print n >>> imported() re __builtins__ sys os types -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list