__import__ with dict values
alex goretoy
aleksandr.goretoy at gmail.com
Thu Mar 12 05:58:20 EDT 2009
How would I import with __import__ from dict values?
I want sys.path value inside d['syspath'], below code doesn't work for me
d={}
d['sys']='sys'
d['path']='path'
d['syspath']=__import__(d['sys'],fromlist=[d['path']])
and how come does above line doesn't give me diff value than below line?
d['syspath']=__import__(d['sys'])
Meaning, when I do this doesn't work. Which makes sense.
d['syspath']()
d['syspath'].d['path']
but this works both with fromlist and without.
d['syspath'].path
-Alex Goretoy
http://www.goretoy.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090312/416ccab6/attachment.html>
More information about the Python-list
mailing list