problem with imort

polux polux2001 at wanadoo.fr
Mon Aug 26 04:14:46 CEST 2002


Hans Nowak wrote:
> polux wrote:
> 
>> I wrote :
>>
>> module=math
>>  >>> import module
>> Traceback (most recent call last):
>>   File "<pyshell#8>", line 1, in ?
>>     import module
>> ImportError: No module named module
>>
>>
>> How to do to give the function import a variable ?
>>
> 
> Use the __import__ function:
> 
>  >>> foo = "math"
>  >>> math = __import__(foo)
>  >>> math
> <module 'math' (built-in)>
> 
> HTH,
> 

Thank You !
ooouhaaaaaaa........it's 4:00 o' clock in frnace :))
going to bed
good night




More information about the Python-list mailing list