[IronPython] Newbie: convert string to python expression??
kristian.jaksch at gmail.com
Tue Dec 16 12:14:38 CET 2008
Thanks for the reply. This is what I have:
def inputBox_KeyDown(s, e):
root.message.Text = ''
key = e.Key.value__
if key == 3:
result = eval(root.inputBox.Text)
root.message.Text = str(result)
eval() seems to work sometimes. For example if the text in the textbox is
1+1 . But if the text for example is a=1 i get an error "Unexpected token
'=' " (This is in Ironpython studio). I guess it is because a=1 is not an
expression. What should I use then? What if I don't know what the user will
View this message in context: http://www.nabble.com/Newbie%3A-convert-string-to-python-expression---tp21029759p21031241.html
Sent from the IronPython mailing list archive at Nabble.com.
More information about the Ironpython-users