On Aug 27, 10:52 pm, Duke Normandin <dukeofp...@ml1.net> wrote:
> How do I convert the contents of "op" from a string to an actual
> arithmetic operator? eval() does not seem to be the answer. TIA!


Try this..

>>> op = '+'
>>> one = '1'
>>> two = '2'
>>> one+op+two
'1+2'
>>> eval(one+op+two)
3


you could also use string formatting.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to