1. 程式人生 > >Colaboratory掛靠Google Drive雲盤方法

Colaboratory掛靠Google Drive雲盤方法

成功結果

--執行程式碼段1:

# Load the Drive helper and mount
from google.colab import drive

# This will prompt for authorization.
drive.mount('/content/drive')

--執行程式碼段2:

# After executing the cell above, Drive
# files will be present in "/content/drive/My Drive".
!ls "/content/drive/My Drive"

--如果要執行drive中某個資料夾程式。程式碼段:

# 指定當前的工作資料夾
import os

# 此處為google drive中的檔案路徑,drive為之前指定的工作根目錄,要加上
os.chdir("drive/My Drive/cifar10")

--檢視當前目錄下檔案:

!ls