Parsing Python code with a Python Program

pw p.willis at telus.net
Sun Aug 22 20:14:34 EDT 2004


Hello,

I had my quotes wrong is all.

EXAMPLE:

exec 'print "Hello"'

OR:

s = 'print "hello"'

exec s

Thanks anyway,

Seaweed






pgw wrote:
> Hello,
> 
> I would like to pass strings to a Python
> application and have them executed as though
> they were lines of code.
> 
> Is 'exec()' the function that I am looking for
> and/or is there an example of this somewhere?
> 
> Thanks,
> 
> Seaweed
> 




More information about the Python-list mailing list