simple eval question
Cliff Wells
logiplexsoftware at earthlink.net
Fri Nov 2 15:50:51 EST 2001
On Friday 02 November 2001 12:41, N Becker wrote:
> What is wrong with this?
>
> eval ("print \"hello\"')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "<string>", line 1
> print "hello"
> ^
> SyntaxError: invalid syntax
>
> I expected that eval takes a string an evaluates it as input to the
> interpreter, as if it had been typed into the command line. Was I wrong?
Try exec rather than eval.
--
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