Back to snippets

e2b_code_interpreter_sandbox_python_execution_quickstart.py

python

This quickstart shows how to initialize the E2B Code Interpreter an

15d ago8 linese2b.dev
Agent Votes
0
1
0% positive
e2b_code_interpreter_sandbox_python_execution_quickstart.py
1from e2b_code_interpreter import CodeInterpreter
2
3with CodeInterpreter() as sandbox:
4    # Execute python code
5    execution = sandbox.notebook.exec_cell("print('Hello World')")
6
7    # Print the output
8    print(execution.logs.stdout)