Catching results of an exec

darrell dgallion1 at
Thu Sep 19 04:23:24 CEST 2002

print a


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