statements and expressions

Cliff Wells logiplexsoftware at earthlink.net
Wed Jan 9 15:52:50 EST 2002


On Wed, 9 Jan 2002 18:32:25 -0300
"Alves, Carlos Alberto - Coelce" <calves at coelce.com.br> wrote:

> Why this two codes doesn't work?!
> 1º case:
> 	exec("print 'Carlos' ")
> 2º case:
> 	x = exec("something")
> In former case, is it beacouse exec(..) requires an expression as
argument
> and print "...." is a statement? And in the latter, beacouse statements
> doesn't support assignments?!

Case 1:  Works for me
Case 2:  Use eval rather than exec for expressions

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list