Python exec() function
Definition and Usage
The exec() function executes the specified Python code.
The exec() function accepts a large number of code blocks, which is different from the eval() function that only accepts a single expression.
Syntax
exec(object, globals, locals)
Parameter Value
Parameter | Description |
---|---|
object | String or code object. |
globals | Optional. A dictionary containing global parameters. |
locals | Optional. A dictionary containing local parameters. |