diff options
Diffstat (limited to 'tools/execute_py_code.py')
| -rw-r--r-- | tools/execute_py_code.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/execute_py_code.py b/tools/execute_py_code.py index ad9310c..a8cfe48 100644 --- a/tools/execute_py_code.py +++ b/tools/execute_py_code.py @@ -7,10 +7,10 @@ def run(code: str): code: Python code to execute, such as `print("hello world")` """ old_stdout = sys.stdout - new_stdout = io.StringIO() - sys.stdout = new_stdout + output = io.StringIO() + sys.stdout = output exec(code) sys.stdout = old_stdout - return new_stdout.getvalue()
\ No newline at end of file + return output.getvalue()
\ No newline at end of file |
