Skip to content

Instantly share code, notes, and snippets.

@puncoz
Created June 12, 2019 11:16
Show Gist options
  • Save puncoz/534b0c2c8f5c1087dd9db23fc85c2f25 to your computer and use it in GitHub Desktop.
Save puncoz/534b0c2c8f5c1087dd9db23fc85c2f25 to your computer and use it in GitHub Desktop.
Some useful code snippets for google colab

To upload file from computer to colab:

from google.colab import files
uploaded = files.upload()

Extract Google Drive zip from Google colab notebook

Mount GDrive:

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

Open the link -> copy authorization code -> paste that into the prompt and press "Enter"

Check GDrive access:

!ls "/content/gdrive/My Drive"

Unzip (q - quite!) file from GDrive:

!unzip -q "/content/gdrive/My Drive/dataset.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment