On Feb 1, 12:51 am, "Jia Lu" <[EMAIL PROTECTED]> wrote: > > def make_module_from_file(module_name, file_name): > > """ Make a new module object from the code in specified file """ > > > from types import ModuleType > > module = ModuleType(module_name) > > > module_file = open(file_name, 'r') > > exec module_file in module.__dict__ > > Thank you very much. > And can you tell me what does " exec module_file in module.__dict__ " > mean? > > Thanx
http://docs.python.org/ref/exec.html It executes whatever code is in module_file and dumps all variables defined in the process into module.__dict__. -- http://mail.python.org/mailman/listinfo/python-list