有没有人想出一种方法来保持文件在 Google 的 newly open sourced Colaboratory 中跨 session 持久保存? ?
使用示例笔记本,我成功地从我的 Google 云端硬盘实例验证和传输 csv 文件,并将它们存储在/tmp、我的 ~ 和 ~/datalab 中。 Pandas 也可以从磁盘上读取它们。但是一旦 session 超时,看起来整个文件系统都被清除了,一个新的 VM 启动了,没有下载的文件。
考虑到 Google 的 Colaboratory Faq,我想这并不奇怪:
Q: Where is my code executed? What happens to my execution state if I close the browser window?
A: Code is executed in a virtual machine dedicated to your account. Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.
鉴于此,也许这是一项功能(即“使用 Google Cloud Storage,它在 Colaboratory 中运行良好”)?当我第一次使用该工具时,我曾希望 My File/Colab Notebooks Google Drive 文件夹中的任何 .csv 文件也能加载到虚拟机实例中笔记本正在运行:/
最佳答案
把它放在你的代码之前,所以总是会在运行你的代码之前下载你的文件。
!wget -q http://www.yoursite.com/file.csv
关于python - 在 Google Colaboratory 中保存数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47194063/