Execute external code and get return value

Peter Otten __peter__ at web.de
Fri Sep 29 14:52:53 CEST 2006


Michele Petrazzo wrote:

> I want to execute an external code, that become from a text file (pe),
> call a function inside it and get its return value:

namespace = {}
execfile("ext_code.txt", namespace)
print namespace["funct2Call"]()

Peter



More information about the Python-list mailing list