Home > AI > Uncategorized

Jupiter notebook

on command line:

jupiter notebook 

start fun!

 

convert .ipynb to python

jupiter nbconvert –to python a.ipynb

 

convert python to .ipynb 


# convert python to jupyter notebook 
import nbformat
import sys
from nbformat.v4 import new_notebook, new_code_cell

nb = new_notebook()
with open(sys.argv[1]) as f:
    code = f.read()

filename = sys.argv[1].split('.')
nb.cells.append(new_code_cell(code))
nbformat.write(nb, filename[0]+'.ipynb')

 

 

Related posts:

Leave a Reply