How to import a module based on an argument

Michel Claveau/Hamster No.Spam.mc at No.Spam.mclaveau.No.Spam.com
Thu Mar 25 16:11:55 EST 2004


Plus utilisable :
More useful :

        def functionname( module, var1):
                exec('from '+module+' import *')
                print upper(var1)

        functionname('string', 'azerty')







More information about the Python-list mailing list