def func(param):
#do something
Code:
enviroment = {'func':func}
eval('func(a)', enviroment, enviroment)
I originally want to use getattr in enviroment, but it seems not helpful
error occured when searching param a in environment, is there any way to catch the error? Then I can append the a in the environment and executing again.
any answer would be appreciated, thank you.