a | b/notebooks/nbtopython | ||
---|---|---|---|
1 | set -e |
||
2 | infile=$1 |
||
3 | jupyter-nbconvert --to python $infile |
||
4 | pyfile="${infile%.ipynb}.py" |
||
5 | |||
6 | cat $pyfile | sed '/^$/N;/^\n$/D' | sed "s/^# In\[[ 0-9]*\]:/#cell#/" > "${pyfile}.tmp" |
||
7 | mv "${pyfile}.tmp" "${pyfile}" |