executing Python statements

Jeff no_spam at umich.edu
Mon Jul 24 16:45:12 EDT 2000


never mind... exec (run_this_string) works

Jeff <no_spam at umich.edu> wrote in message
news:8li9mm$ehe at news.or.intel.com...
> Hi, say I have a variable called 'x', and it is 100.  I have another
> variable called 'run_this_string' and it reads 'print x'.  How can I then
> execute run_this_string and get 100 to print out?  Here is a code snippet:
>
> x = 100
> run_this_string = 'print x'
>
>
>





More information about the Python-list mailing list