stringExp = \"2^4\" intVal = int(stringExp) # Expected value: 16
This returns the following error:
Traceback (most recent call
Some safer alternatives to eval() and sympy.sympify().evalf()*:
eval()
*SymPy sympify is also unsafe according to the following warning from the documentation.
Warning: Note that this function uses eval, and thus shouldn’t be used on unsanitized input.
eval