如何减小iPython笔记本的文件大小? [英] How can I reduce the file size of my iPython notebook?

查看:111
本文介绍了如何减小iPython笔记本的文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IPython笔记本,它的大小为几兆字节,尽管其中的代码仅约100行.我认为它很大,因为我在其中加载了多个图像.

I have an IPython notebook which is several megabytes big although the code inside is just about 100 lines. I think it is that huge because I load several images inside.

我想将此笔记本添加到git存储库中.但是,我不想上传可以轻易再次生成的大文件.

I would like to add this notebook to a git repository. However, I don't want to upload something that big which can easily be generated again.

是否可以仅保存IPython笔记本的代码以减小其大小?

Is it possible to save just the code of an IPython notebook to reduce its size?

推荐答案

您可以尝试以下步骤,因为它对我有用:

You can try following steps since it worked for me:

选择单元格"->然后选择所有输出"->在那里,您将找到清除"选项.

Select the "Cell" -> then select "All Outputs" -> There you will find "Clear" option select that.


然后保存文件.


And then save the file.

这将减小文件的大小(从MB到kbs).还将减少您下次在浏览器中打开笔记本时加载笔记本的时间.

This will reduce the size of your file (From MBs to kbs). It will also reduce the time to load the notebook next time you open it in your browser.

根据我的理解,这将清除执行代码后创建的所有输出.由于Notebook除此之外还保存有代码,图像和注释,因此它也保存该文件中的输出,因此会增加笔记本的大小.

As per my understanding this will clear all the output created after execution of the code. Since Notebook is holding code+images+comments in addition to this its also holding the out put in that file therefore it will increase the size of the notebook.

这篇关于如何减小iPython笔记本的文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆