访问Google Colab中的文件

莫利VX

我是Google Colab的新手。我已经使用以下代码从Kaggle下载数据集:

!pip install kaggle

import os
os.environ['KAGGLE_USERNAME'] = "xxxxxxxxx"
os.environ['KAGGLE_KEY'] = "xxxxxxxxxxxxxxxxxxxxxxxxxx"

!kaggle competitions download -c dogs-vs-cats-redux-kernels-edition

os.chdir('/content/')
#dowloaded data in this directory

我现在可以访问所有数据,但是这些数据存储在哪里?在我的Google云端硬盘中?但是我找不到。如果我想从在Colab中运行的其他笔记本访问相同的数据怎么办?两个笔记本都存储在我的Google云端硬盘中,但是似乎有各自不同的“ / content /”文件夹。

g3ida

要将数据存储在Google驱动器中,您必须先使用以下方法链接驱动器:

from google.colab import drive
drive.mount('/content/drive')

然后您可以通过浏览来访问驱动器 "/content/drive/My Drive/"

因此您可以使用以下命令将数据下载到驱动器:

!kaggle competitions download -p "/content/drive/My Drive/" -c dogs-vs-cats-redux-kernels-edition

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章