Shark Deng

Interactive Designer @Shanju Design in Shanghai

touched caffe / mxnet / python / wordpress / bootstrap / Arduino / Raspberry Pi / webgl / three.js / PIXI / 3dMax

Email

Github

Jupiter notebook

2019-11-20 16:55:12

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')

 

 



——By SharkDeng
如果你喜欢我的文章,欢迎红包赞赏

Leave a Reply

Your email address will not be published. Required fields are marked *