python - 如何在colab中打开Goog​​le Drive中的json文件

标签 python json google-drive-api google-colaboratory

我想使用 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'

关于python - 如何在colab中打开Goog​​le Drive中的json文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57840143/

相关文章:

python - 有人知道如何使用 selenium webdriver 识别 shadow dom web 元素吗?

python - 不同的 Numpy reshape 为 3D 数组语法

python - 在表达式树中查找和替换函数

json - 您如何在 REST 中对复杂操作进行建模?

google-apps-script - 在 Google Apps 脚本中将文件的所有权转移给其他用户

python - 估计回归中的后验预测

php - Laravel 中的 mariaDB JSON 支持

javascript - JSON 日期到普通 JS 日期

javascript - 如何使用 Google Drive Javascript API 更新 Google Drive 中的 zip 文件

google-drive-api - Google Drive pod 中的 FirebaseCore 3.4.7 模块损坏了工作区