Exec Multiple Lines?

Chris S. chrisks at NOSPAMudel.edu
Sat Jun 12 02:26:39 EDT 2004


I'd like to dynamically execute multiple lines of indented code from 
within a script, but I can't seem to find a suitable function. Exec only 
works with unindented code, and execfile only works with files. I 
suppose I could write my string to a temporary file and then use 
execfile, but that seems like a hack. Is there an easier way? Any help 
is appreciated.



More information about the Python-list mailing list