B
Brian Blais
Hello,
I have a string input from the user, and want to parse it to a number, and would like
to know how to do it. I would like to be able to accept arithmetic operations, like:
'5+5'
'(4+3)*2'
'5e3/10**3'
I thought of using eval, which will work, but could lead to bad security problems
(not that it's a big deal in my app, but still...)
string.atof won't do the job. Is there a preferred way of doing this?
thanks,
Brian Blais
I have a string input from the user, and want to parse it to a number, and would like
to know how to do it. I would like to be able to accept arithmetic operations, like:
'5+5'
'(4+3)*2'
'5e3/10**3'
I thought of using eval, which will work, but could lead to bad security problems
(not that it's a big deal in my app, but still...)
string.atof won't do the job. Is there a preferred way of doing this?
thanks,
Brian Blais