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

Michael Hartl mhartl at post.harvard.edu
Sat Feb 5 17:11:07 EST 2005


Use the eval function:

>>> eval("30/(6+9)")
2

Michael




More information about the Python-list mailing list