How do I convert arithemtic string (like "2+2") to a number?

John J. Lee jjl at pobox.com
Sun Feb 6 09:32:32 EST 2005


"Adomas" <adomas.paltanavicius at gmail.com> writes:

> Well, a bit more secure would be
> 
> eval(expression, {'__builtins__': {}}, {})
> 
> or alike.

Don't believe this without (or even with ;-) very careful thought,
anyone.  Google for rexec.


John



More information about the Python-list mailing list