how to evaluate string expression in python code example
Example 1: eval in python
eval(expression, [globals[, locals]])
Example 2: python evaluate string
# Be *extremely* cautious when using eval(), make sure that the user can't
# execute their own code, otherwise it's a very helpful function.
>>> eval("print(\"Hello, World!\")")
Hello, World!