Exec acting like execfile

Robert Hanlin findler_lambda at yahoo.com
Mon Aug 12 22:13:37 EDT 2002

Hi all,

exec is a keyword that just expects a string, while execfile() is a
function that accepts a filename and dicts of global and local vars. 
So execfile() seems more powerful.  But slower because you're reading
in a file.

Is there any way to use exec with execfile's power?  I found that
Python has an undocumented exec() function, but Jython doesn't.  And I
need Jython.  How do others work around this?

Thanks in advance.

More information about the Python-list mailing list