Google colab changing directory

后端 未结 6 2008
我在风中等你
我在风中等你 2020-12-09 10:44

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\")

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 11:41

    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/

提交回复
热议问题