compile() source code from a string
Costas Menico
costas at meezon.com
Thu Mar 1 21:17:02 EST 2001
If you look at my post this is exactly what I am doing. I cannot get
this to work with multiline code (as in my example). Can you give me
an example how to make it work?
costas
Alex <new_name at mit.edu> wrote:
>
>>>> print compile.__doc__
>compile(source, filename, mode) -> code object
>
>Compile the source string (a Python module, statement or expression)
>into a code object that can be executed by the exec statement or eval().
>The filename will be used for run-time error messages.
>The mode must be 'exec' to compile a module, 'single' to compile a
>single (interactive) statement, or 'eval' to compile an expression.
>>>>
>
>So, you want the 'exec' option.
>
>Alex.
>
More information about the Python-list
mailing list