Re: [Tutor] Evaluating a string expression

2009-11-06 Thread Alan Gauld
"Modulok" wrote I would like to know how would I evaluate a string expression in python. For example, if i say: a = "3*2" I want to do something to evaluate the variable 'a' to give me 6. How can I do this? [/snip] The eval() function can do this: eval("3*2") WARNING: Long winded securi

Re: [Tutor] Evaluating a string expression

2009-11-05 Thread Modulok
[snip] > I would like to know how would I evaluate a string expression in python. > For example, if i say: a = "3*2" > I want to do something to evaluate the variable 'a' to give me 6. How > can I do this? [/snip] The eval() function can do this: eval("3*2") WARNING: Long winded security