I can't change my directory in Google colab. when I type cd it gives output like this '/content' I tried to change the directory using import os os.chdir("drive")
but it shows error No such file or directory: 'drive' . How to get rid of this?
To change the current working directory in Python, use the chdir() method. The method accepts one argument, the path to the directory to which you want to change. The path argument can be absolute or relative.
If you want to change directory from google colab into google drive, connect to google drive first.
from google.colab import drive
drive.mount('/content/drive')
It will ask for authentication key that will be can be obtained when signing in to your google drive
Change to the google drive directory.
%cd /content/drive/My\ Drive/
For verifying:
!pwd
Your current directory is /content/drive/My Drive/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With