是否可以在不知道结构的情况下制作将与python 3.6中的另一个文件相同的hdf5文件? [英] Is is possible without knowing structure to make hdf5 file that will be the same copy of another one in python 3.6?

查看:52
本文介绍了是否可以在不知道结构的情况下制作将与python 3.6中的另一个文件相同的hdf5文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个hdf5文件 f1.h5 ,并且我想将此文件复制到另一个文件中(例如 f2.h5 ),但是我没有我不知道 f1.h5 的结构,我想自动复制它,我可以使用 h5py 的一些技巧来做到这一点吗?

If I have one hdf5 file f1.h5 and I want to make a copy of this file to another one (e.g. f2.h5), but I don't know the structure of f1.h5 and I want to copy it automatically, can I do it with some tips of h5py?

推荐答案

我不了解h5py,但是应该可以通过以下方式实现:

I don't know about h5py, but it should be possible by:

f1=open('f1.h5','rb')
f2=open('f2.h5','wb')

f2.write(f1.read())

您读取第一个文件的每个字节并将其写入第二个文件.诸如结构之类的东西都没关系

You read each byte of the first file and write it to the second file. Things such as structure don't matter

这篇关于是否可以在不知道结构的情况下制作将与python 3.6中的另一个文件相同的hdf5文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆