Module inspection by name

Jean-Michel Pichavant jeanmichel at
Tue Sep 22 18:19:41 CEST 2009

Nadav Chernin wrote:
> Hi all, a have easy question for python developers.
> Assume I have list of all objects:
> obj=dir()
> Now I want to know which object from “obj” list is module.
> I searched some method in module inspection, but there is not any 
> method that get ‘string’ as parameters
> Any reply will be greatfull
> Nadav

import sys
import os
name = 'os'

will return the module itself with the string name. It should allow you 
to use the method you found using the module itself.


More information about the Python-list mailing list