用Google Colab写出文件 [英] Write out file with google colab

查看:134
本文介绍了用Google Colab写出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以用Google colab写出文件? 例如,如果我使用

Was there a way to write out files with google colab? For example, if I use

import requests
r = requests.get(url)

这些文件将存储在哪里?可以找到它们吗? 同样,我可以通过tensorflow save函数获取输出的文件吗?

Where will those files be stored? Can they be found? And similarly, can I get the file I outputted via say tensorflow save function

saver=tf.Saver(....)
...
path = saver.save(sess, "./my_model.ckpt")

谢谢!

推荐答案

在您的第一个示例中,数据仍位于r.content中.因此,您还需要先使用open('data.dat', 'wb').write(r.content)

In your first example, the data is still in r.content. So you also need to save them first with open('data.dat', 'wb').write(r.content)

然后您可以使用files.download

from google.colab import files
files.download('data.dat')

下载模型是相同的:

files.download('my_model.ckpt')

这篇关于用Google Colab写出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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