- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions_exec().py
More file actions
Latest commit
22 lines (15 loc) · 599 Bytes
/
Copy pathFunctions_exec().py
File metadata and controls
22 lines (15 loc) · 599 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Python exec() Function
# Example
# Execute a block of code:
x='name = "John"\nprint(name)'
exec(x)
# Definition and Usage
# The exec() function executes the specified Python code.
# The exec() function accepts large blocks of code, unlike the eval() function which only accepts a single expression
# Syntax
# exec(object, globals, locals)
# Parameter Values
# Parameter Description
# object A String, or a code object
# globals Optional. A dictionary containing global parameters
# locals Optional. A dictionary containing local parameters