Calling Python Code Snippets within Python Application
Cameron Laird
claird at lairds.com
Mon Apr 14 16:28:05 EDT 2003
In article <slrnb9kumi.1q1.rmunn at localhost.localdomain>,
Robin Munn <rmunn at pobox.com> wrote:
.
.
.
>Look at the eval() or execfile() built-ins:
>
> http://www.python.org/doc/current/lib/built-in-funcs.html
>
>Note that eval() evaluates an expression -- if you want to use eval() to
>run chunks of Python code, you might have to wrap those chunks in a
>function and eval() the result of calling that function. execfile() will
>work if the code you want is in a file; if it's in a database, you might
>have to write it to a temporary file and then execfile() that temporary
>file.
.
.
.
? When is it advantageous to write to a temporary file
and apply execfile() rather than exec directly?
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html
More information about the Python-list
mailing list