I have a function called 'somefunc' :
def somefunc(): return "ok" And i wanted to run it with exec() like :
exec("somefunc()") That works great. But the problem is, i can't get the returned value "ok". I've tried to do this:
a = exec("somefunc()") print (a) But i've got nothing. how can i get the returned value?
execsolutions are seldom optimal.