I know that there are several ways to execute a string which represents a
piece of python code.
Out of curiosity, is it only eval which returns a value? (as below, where
the string corresponds to a defined function).

def addone(val):
...     return val + 1
...
res = eval('addone(10)')

Thanks!
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to