Re: Execute a list

2005-02-22 Thread Swaroop C H
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

2005-02-22 Thread Martin Miller
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

Execute a list

2005-02-22 Thread Groleo Marius
Hi. How can i execute a string in python? For example if I have the variable s, defined below s = '"print "hello"' How can I execute the code that "s" keeps inside, considering that the code is correct? -- http://mail.python.org/mailman/listinfo/python-list