Extract Google Drive zip from Google colab notebook

前端 未结 12 1572
醉梦人生
醉梦人生 2020-12-25 12:29

I already have a zip of (2K images) dataset on a google drive. I have to use it in a ML training algorithm. Below Code extracts the content in a string format:



        
12条回答
  •  悲&欢浪女
    2020-12-25 13:15

    To extract Google Drive zip from a Google colab notebook:

    import zipfile
    from google.colab import drive
    
    drive.mount('/content/drive/')
    
    zip_ref = zipfile.ZipFile("/content/drive/My Drive/ML/DataSet.zip", 'r')
    zip_ref.extractall("/tmp")
    zip_ref.close()
    

提交回复
热议问题