Catching results of an exec

darrell dgallion1 at yahoo.com
Wed Sep 18 22:23:24 EDT 2002


exec("a=dir()")
print a

--Darrell


Greg Fortune wrote:

> Is there any way to "catch" the value produced by an exec?  I'm
> considering things like print statements that don't really assign a value,
> but do send a result to stdout.
> 
> For example, if I execute
> 
> exec('print dir()')
> ...




More information about the Python-list mailing list