I have a textfile containing the source code for an Ipython Notebook.
How can I convert this file using Ipython / Python to an Ipython Notebook?
e.g. :
source.txt:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Test"
]
},
}
...
The questions on SE deal with converting an actual notebook to a .py or otherwise. I'm looking just to get to the notebook in the first place.
Edit: I'm on Mac
You need to first install iPython package
pip install ipython
Save your current file as .py file using notepad++ Then try below code
import IPython.nbformat.current as convert
conv = convert.read(open('source.py', 'r'), 'py')
convert.write(conv, open('source.ipynb', 'w'), 'ipynb')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With