[python] dynamicke importovani modulu

Tomas Morstein tmr na fooboo.org
Čtvrtek Duben 20 22:08:58 CEST 2006


Zdravim,

zkusil bych pouzit exec:

>>> m = "sin,radians"
>>> exec("from math import " + m)
>>> print "sin30 = %f" % sin(radians(30))
sin30 = 0.500000

T.


-- 
There is hopeful symbolism in the fact that flags do not wave in a
vacuum.
		-- Arthur C. Clarke


Další informace o konferenci Python