在google colab中下載kaggle數據集


!pip install kaggle
api_token = {"username":"lky190249","key":"8e5bafa71ffe555c3fe75749523743c2"}
import json
import zipfile
import os
with open('/root/.kaggle/kaggle.json', 'w') as file:
    json.dump(api_token, file)
!kaggle datasets download -d iarunava/happy-house-dataset
if not os.path.exists("/content/competitions/happy-house-dataset"):
    os.makedirs("/content/competitions/happy-house-dataset")
os.chdir('/content/competitions/happy-house-dataset')
for file in os.listdir():
    zip_ref = zipfile.ZipFile(file, 'r')
    zip_ref.extractall()
    zip_ref.close()

參考鏈接:https://gist.github.com/jayspeidell/d10b84b8d3da52df723beacc5b15cb27


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM