imp.load_source() - explanation needed
mynthon
mynthon1 at gmail.com
Wed Apr 1 15:17:13 EDT 2009
Hi!
I need help. I don't understand what doc says.
I load module from path testmod/mytest.py using imp.load_source(). My
code is
import imp
testmod = imp.load_source('koko', 'testmod/mytest.py)
print testmod
but i don't understand whatt is first (name) argument for. Docs says
that "The name argument is used to create or access a module object."
But i still don't understand. I cant do this
import imp
testmod = imp.load_source('koko', 'testmod/mytest.py)
print koko
How i can access module object using its name? Is " print sys.modules
['koko'] " only way or am i missing something?
More information about the Python-list
mailing list