
Python Code Interpreter
Executes Python code in a secure, isolated environment with persistent context and the ability to install packages and save files.
What it does
- Execute Python code snippets
- Install Python packages via pip
- Save code to files and run them
- Extract specific variable values from executed code
- Run existing Python files
Best for
Tools (4)
Run Python code in the current environment. Parameters: code: The Python code to execute variable_to_return: Optional variable name to return its value Returns: str: The value of variable_to_return if provided, otherwise success message or error
Save Python code to a file and run it. Parameters: file_name: Name of the file to save (e.g., "script.py") code: Python code to save and execute variable_to_return: Optional variable name to return its value overwrite: Whether to overwrite existing file Returns: str: The value of variable_to_return if provided, otherwise success message or error
Install a Python package using pip. Parameters: package_name: Name of the package to install Returns: str: Success message or error information
Run an existing Python file. Parameters: file_name: Name of the Python file to run variable_to_return: Optional variable name to return its value Returns: str: The value of variable_to_return if provided, otherwise success message or error