On Sat, 2005-02-05 at 17:11, Michael Hartl wrote:
> Use the eval function:
> 
> >>> eval("30/(6+9)")
> 2
> 
> Michael

Sure, if you trust the source of the string you are evaluating.  If this
is a form submission on your web site, be wary of the nefarious user who
might submit to you:

commands.getoutput( "rm -rf %(HOME)s"%os.environ )

as the "expression" to evaluate.


Adam DePrince 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to