How can i import a module via the eval() function? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How can i import a module via the eval() function?

eval(" ") #how?

12th Aug 2018, 10:02 AM
Yan
Yan - avatar
5 Antworten
+ 8
math = eval('__import__("math")') print(math)
12th Aug 2018, 10:07 AM
Mert Yazıcı
Mert Yazıcı - avatar
+ 8
But why eval() it,when you can just use it directly?
12th Aug 2018, 10:39 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
᠌᠌brains just interesting
12th Aug 2018, 10:44 AM
Yan
Yan - avatar
0
im stuck on the stuff
12th Aug 2018, 3:17 PM
matthew
0
matthew why? do you know this language?
12th Aug 2018, 5:01 PM
Yan
Yan - avatar