[python-win32] How Can I exec() a statement?
Bob Gailer
bgailer at alum.rpi.edu
Wed Apr 6 22:20:24 CEST 2005
At 10:57 AM 4/6/2005, * William wrote:
>[snip]
>I want to execute a statement indirectly in Python. Take the simple case
>below. The chevrons ">> " indicate the result of the statement
>b = 2
>a = b + 6
>eval('a = b + 6', globals(), locals() )
There are often better solutions than exec. Tell us a bit more about what
you are trying to accomplish.
Bob Gailer
mailto:bgailer at alum.rpi.edu
510 558 3275 home
720 938 2625 cell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050406/8725a49e/attachment.html
More information about the Python-win32
mailing list