Dynamic code execution with exec and eval

0Executing code provided by untrusted user using exec eval or ast.literal eval

Evaluating statements with exec

Evaluating an expression with eval

Precompiling an expression to evaluate it multiple times

Evaluating an expression with eval using custom globals

Evaluating a string containing a Python literal with ast.literal eval