Re: Execute a list
Groleo Marius wrote: How can i execute a string in python? How can I execute the code that "s" keeps inside, considering that the code is correct? Use the exec statement : `exec s` Details at http://www.python.org/doc/ref/exec.html Regards, -- Swaroop C H Blog: http://www.swaroopch.info Book: http:
Re: Execute a list
Here is how to execute code in a string, similar to what was shown in your example: >>> s = 'print "hello"' >>> exec s hello Hope this helps. -- http://mail.python.org/mailman/listinfo/python-list