我在名为xyz.zip的zip文件中有很多文件夹,例如year / month / date / data.npz文件。我尝试使用
rf = zipfile.ZipFile(zip_file_path, 'r') ### load zip file
with rf.open(data_file_path) as target_f:
result = np.load(target_f)
但是,它没有用。我也尝试过
with io.BufferedReader(rf.open(data_file_path)) as target_f:
result = np.load(target_f)
但它仍然报告错误
Exception AttributeError: "'NpzFile' object has no attribute 'zip'" in <bound method NpzFile.__del__ of <numpy.lib.npyio.NpzFile object at 0x7f234ea1f510>> ignored
是否有可能使其工作?或者我必须手动解压缩文件....