[Tutor] strings and int()

Mr Gerard Kelly s4027340 at student.uq.edu.au
Thu Jan 15 01:14:28 CET 2009

If you have a string "6", and you do int("6"), you get the number 6.

But if you have a string "2*3" and you do int("2*3") you get a name error.

How do you take an expression in a string, and evaluate the expression
to get a number?

I want to be able to turn the string "2*3" into the number 6.


More information about the Tutor mailing list