I use the Jupyter 4.1.
I've found the results of the cells are also saved into the ipynb
file. Can I disable it? I want manage it with Git.
For example, there is a cell of my notebook,
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"autoscroll": "json-false",
"collapsed": false,
"ein.tags": [
"worksheet-0"
],
"slideshow": {
"slide_type": "-"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2016-08-04 : 749591\n",
"2016-08-05 : 447416\n",
"2016-08-06 : 305969\n",
]
}
],
"source": [
"curidx = (data.cur_day - data.start_day).days\n",
"for iday in range(curidx, data.nday):\n",
" day = data.cur_day + dt.timedelta(iday - curidx)\n",
" print \"%s : %d\"%(day, int(pdata.barCn[iday]))\n"
]
}
I don't want the contents of the outputs to be saved.
There are two ways to hide content: To hide Markdown, use the {toggle} directive. To hide or remove code cells or their outputs, use notebook cell tags.
Suppress functions print output If you want to stop the messages from print function with Jupyter Notebook you can use: %%capture.
Entering (and exiting) ipython You can also hit Ctrl-D to exit out of ipython. In fact, using your keyboard is the most highly recommended way.
Saving your edits is simple. There is a disk icon in the upper left of the Jupyter tool bar. Click the save icon and your notebook edits are saved.
Thanks @Thomas K, guided by his advice, I've found the solution that is use the nbstripout. The usage is below
nbstripout --install
to install a git attribute filter which will strip out the outputs from the ipynb file when it's added to the git cache.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