Hi,
If I execute the following code I will get the the output as 2. What I need
is to execute the string str. Is there a way that I can execute the string
str as it is, so I will get the output as 5.



def add(a,b):
return a+b

var = 2
str = "var = add(2,3)"
# execute the code snippet inside the str string variable
print var

-- 
Regards,
Heshan Suriyaarachchi
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to