-1
我一直試圖在Python 2.7下打開一個現有的.h5數據文件。不過,我一直得到這個錯誤我的代碼如下所示:hdf5文件打開錯誤:「TypeError:'type'object has no attribute'__getitem__'」
而結果是:
我一直試圖在Python 2.7下打開一個現有的.h5數據文件。不過,我一直得到這個錯誤我的代碼如下所示:hdf5文件打開錯誤:「TypeError:'type'object has no attribute'__getitem__'」
而結果是:
你試圖把該項目名稱爲「 /訓練「類的」文件「。類「文件」不是一個集合。我不明白你想在6行代碼中做什麼。 也許你的意思是
import h5py
import numpy as np
filename = 'train.h5'
# open file for Read/write
f = h5py.File(filename, 'r+')
# get group or dataset in h5 file
dataset = f["/train"]
你可以請你的代碼發佈爲TXT,而不是圖像?所以人們幫助你更容易 – Massimo