python eval() function code example Example 1: python eval set variable exec('x=1') Example 2: eval in python eval(expression, [globals[, locals]])