簡體   English   中英

如何在Colab中的Google Drive中打開JSON文件

[英]How to open json file in google drive in colab

我想用google colab在我的google驅動器中打開json文件。 但是有一個錯誤。

from google.colab import drive
drive.mount('/content/drive')
os.chdir("/content/drive/My Drive/Colab Notebooks")
os.listdir()

['keras.ipynb',
 'ItemData.json',
 'DropData.json',
 'DefaultUserData.json',
 'MonsterData.json',
 'DungenData.json',
 'EquipData.json',
 'UserData.json',
 'game balancing.ipynb']

當然有'itemData.json'文件,但是當我嘗試打開...

with open('itemData.json') as json_file:
    itemData = json.load(json_file)

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-52-da912edd7528> in <module>()
----> 1 with open('itemData.json') as json_file:
      2     itemData = json.load(json_file)

FileNotFoundError: [Errno 2] No such file or directory: 'itemData.json'

有什么問題???

嘗試做出正確的案例。

'itemData.json'

一定是

'ItemData.json'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM