Skip to content

Instantly share code, notes, and snippets.

@jonasrk
Created May 22, 2022 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasrk/2cadc195c1b80c5cf853c514444d93cf to your computer and use it in GitHub Desktop.
Save jonasrk/2cadc195c1b80c5cf853c514444d93cf to your computer and use it in GitHub Desktop.
myst-blogpost % python
Python 3.9.6 (default, Jul 29 2021, 11:06:22)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nbformat
>>> import nbclient
>>> with open('input.ipynb') as ipynb_file:
... nb = nbformat.read(ipynb_file, nbformat.NO_CONVERT)
... nb_ex = nbclient.execute(nb)
...
>>> with open("output.ipynb", "w") as ipynb_out_file:
... nbformat.write(nb, ipynb_out_file)
...
>>>
myst-blogpost % ls
input.ipynb input.myst output.ipynb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment