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

Arvid Andersson arvid at linux.se
Sat Feb 5 18:31:42 EST 2005


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

Thanks, just what I was looking for!




More information about the Python-list mailing list