ID EN
Built-in Functions

eval

Python 3.11

The arguments are a string and optional globals and locals. If provided, globals must be a dictionary. If provided, locals can be any mapping object.

Syntax

PYTHON
eval(expression, globals=None, locals=None)

Examples

Example 1
PYTHON
>>> x = 1
>>> eval('x+1')
2

See Also

builtins eval() eval() nested scopes compile() eval() exec() globals()