Back to EditorPlay Python

Play Python

How to Use the Playground

1. Start Coding Immediately

Python runs inside your browser using Pyodide (WebAssembly). You can open the editor and run code without creating an account or setting up a local environment. Your script executes in a browser sandbox and the output appears in the Output panel at the bottom.

2. Work with Multiple Files and Folders

  • Use the file explorer to create files/folders, rename, move, upload, and delete.
  • Open files into tabs; each tab tracks unsaved changes and deleted-file status.
  • Download a single file or a full project ZIP from the explorer.
  • Your project is synchronized into Pyodide's virtual filesystem automatically when running code/tests.

3. Run, Test, Lint, and Format

  • Click Run (or press Ctrl+Enter) to execute the active file.
  • Pass command-line arguments after run in the terminal (e.g. run --size 3); they arrive in sys.argv.
  • Use Test to run pytest against test files in your project.
  • Use Lint and Format (Ruff WASM) to check style issues and auto-format code in-browser.
  • If your code calls input(), its prompt appears on the terminal's input line: type your reply there and press Enter. The prompt dialog is only a fallback, used when the terminal is unavailable.

4. Install Packages and Use Runtime Settings

  • Install Python packages from the package panel (subject to Pyodide compatibility).
  • Configure Env Vars from Settings: public/secret variables are injected into the runtime via os.environ.
  • Load env vars from project files such as .env or .env.dev.
  • Environment variables are session-local and excluded from shared URLs.

5. Where Your Code Actually Runs

  • Python executes locally in your browser. The code you run never leaves the page.
  • Sharing does not execute anything: it only encodes your project files into a URL.
  • Browser/WASM limitations apply — no native subprocesses, and no full OS filesystem access.
  • Package support depends on which distributions are available for Pyodide.

Using the Terminal

The Output panel is a working shell: click it and type. It accepts the commands below, and everything a program prints lands in the same scrollback, so you can scroll back through earlier runs with the mouse wheel, swipe, or PageUp/ PageDown. The buttons in its title bar copy the transcript, cut it, clear it, or paste text at the prompt.

  • run — run the file in the active tab, the same as the Run button.
  • clear — empty the terminal, same as the Clear button.
  • help — list the supported commands.

Anything typed after the command word is passed to the program as command line arguments, so the arguments do not need a separate panel. Quote anything containing spaces:

  • run --eq "5 + 3" — evaluates the expression and prints the result.
  • run --interactive — start an interactive program.

When a program waits for input, its prompt appears on the terminal's own input line and you reply by typing there and pressing Enter — no separate dialog. Press Ctrl+C to stop waiting and hand the program an end-of-input.

Command line arguments and interactive input apply to Python, which runs in your browser. Rust is compiled as a whole crate by the Rust Playground, which takes no arguments and has no stdin — there, run simply runs the crate.

Critical Security Warning

  • Shared URLs encode your project file contents. Anyone with the link can read them, so treat a shared link as publishing the files.
  • If you use Env Vars (Python) and then share or save files to a link, those secrets can be exposed, because shared state URLs encode project file contents.
  • The .gitignore feature is best-effort only and makes no guarantee that sensitive material will always be filtered in all cases.
  • Rust additionally sends your source to a third-party service to compile and run it — see that tab's first section.
  • This playground is not responsible for any leakage, misuse, compromise, loss, or damages resulting from secret exposure.
  • It is not liable for harm, interruption, data loss, missed deadlines, or damages resulting from the editor or execution service being unavailable.

About the Creator

The playground is developed and maintained by Jim Chng. Connect on LinkedIn or explore the source code on GitHub.