Data Format Conversions

Jupyter Notebook to Python Converter

Convert a Jupyter notebook (.ipynb) into a Python script. Code cells are kept in order, Markdown cells become comments or docstrings, and IPython magics like %matplotlib or !pip are commented out or turned into get_ipython() calls so the script runs.
Runs in your browserLive result

Workspace

Options

How to use this tool

  1. 1Open an .ipynb file (or paste its JSON).
  2. 2Choose cell markers: # %% cells (VS Code, PyCharm, Spyder, Jupytext) or a plain script.
  3. 3Choose how Markdown and magics are handled.
  4. 4Download the .py file.

Frequently asked questions

They split the script into cells that VS Code, PyCharm, Spyder and Jupytext can run one at a time, just like a notebook. Choose Plain script for a normal .py file.

They are IPython-only syntax. Comment out keeps the script runnable with plain python; get_ipython() calls keep them working under the ipython command.

No. Outputs, images and execution counts are not part of the code, so only cell sources are converted.

The cells are copied, but the result is not Python; the tool warns you when the notebook kernel is not Python.

No. The conversion runs in your browser with JavaScript. Your file or pasted text is not uploaded, logged or stored by MuhammadLab.