I have a string variable containing a function. the function is as follows:
def program():
x[0] = y[1]
z[0] = x[0]
out = z[0]
This is the method:
def runExec(self, stringCode):
x = [1,2,3,4]
y = [5,6,7,8]
z = [6,7,8,9]
exec stringCode
return out
I get a NameError, it seems that x, y and z are not available from execCode exec?
How can I make these variables available, do I need to somehow pass them?
thank
source
share