- 1
How do I use exec() inside a function.
Example: def fun(): exec('x = 20') return x print(fun()) This function when executed gives error that x is not defined.
1 Réponse
+ 5
Muneer S A
exec is a very dangerous function.
Might I suggest you learn basic code syntax before playing with this function