how to mount drive in google colab code example

Example 1: connect google drive to colab

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

Example 2: colab mount drive

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

#Optional: move to the desired location:
%cd drive/My Drive/DIRECTORY_IN_YOUR_DRIVE

Example 3: unmount google drive colab

from google.colab import drive
drive.flush_and_unmount()

Example 4: google colab upload a file

from google.colab import files
files.upload()

Tags:

Go Example