2021年5月5日星期三

How to turn a string expression into a normal expression in python

i just want to know how to turn a string expression into a normal expression, where I can solve it.

Example:

"1 + 1"  

i don't want the above in a string, I want it to be

1 + 1  

Another example:

"2(4 - 3) * 2"  

i want to above to be the bottom instead:

2(4 - 3) * 2  

like that. So could someone please let me know how to do that? Thanks!

https://stackoverflow.com/questions/67410604/how-to-turn-a-string-expression-into-a-normal-expression-in-python May 06, 2021 at 09:04AM

没有评论:

发表评论