在colab中导入与您共享/由您共享的Google云端硬盘文件 [英] Import Google Drive files shared with/by you in colab

查看:1367
本文介绍了在colab中导入与您共享/由您共享的Google云端硬盘文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很明显,此最简单推荐了一种还提供了用于从驱动器文件夹

中读取文件的最简单的API

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

―不允许访问您在Google云端硬盘中与您共享的文件/文件夹,而仅允许访问您自己的硬盘文件,从而使其不适用于共享笔记本(或至少需要访问共享Google驱动器文件夹中的数据的共享笔记本.

是否可以使用相同的API访问与您共享的google驱动器文件夹,或者依赖于google驱动器共享权限而不是具有链接的任何人都可以访问" google驱动器超链接的其他任何文件夹?

我相信所有其他方式都需要使用文件id并对其进行硬编码,而上述API可以按名称访问驱动器文件,有时可以更容易维护.

您可以对共享的Google云端硬盘文件使用相同的API吗?

解决方案

共享文件的简单解决方案是,通过右键单击云端硬盘与我共享"列表中的文件,然后选择添加到云端硬盘"项.之后,该文件将出现在/content/drive/My Drive/

It is rather obvious that this simplest recommended way which also provides the simplest API for reading the files from a drive folder ―

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

― does not allow access to files/folders shared with/by you in Google Drive, but only allows access to your own drive's files, making its use less of a fit for shared notebooks (or at least, shared notebooks that need to access data from shared google drive folders).

Is it possible to access google drive folders shared by/with you using the same API, or any of the other ones which rely on google drive sharing permissions and not "anyone with the link can access" google drive hyperlinks?

I believe all other ways require the use and hard-coding of file id's, whereas the API mentioned above can access drive files by name, which at times can be simpler to maintain.

Can you use the same API for shared Google Drive files?

解决方案

A simple solution for shared files is to add them to you Drive by right clicking on the file in the 'shared with me' list in Drive and selecting the 'Add to Drive' item. Afterward, the file will appear in /content/drive/My Drive/

这篇关于在colab中导入与您共享/由您共享的Google云端硬盘文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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