Triple quoted string in exec function ?

Stef Mientki stef.mientki at gmail.com
Fri Jan 2 14:39:25 CET 2009


Stef Mientki wrote:
> hello,
>
> I'm running scripts, with the execute function (Python 2.5),
> and it seems that triple quoted strings are not allowed.
>
> Is there a workaround,
> or is this a fundamental problem of the exec-function ?
>
> thanks,
> Stef Mientki
thanks for all the answers,
but I still don't understand it yet :-(
So maybe someone could explain why the next few lines of code don't work:

Code = ''
Code += """multiline comment
and more lines"""
exec ( Code )

thanks,
Stef Mientki




More information about the Python-list mailing list