我可以通过序列化将文件(HDF5文件)存储在另一个文件中吗? [英] Can I store a file (HDF5 file) in another file with serialization?

查看:113
本文介绍了我可以通过序列化将文件(HDF5文件)存储在另一个文件中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HDF5文件和我需要存储以保存功能的对象列表.为简单起见,我只想创建一个保存文件.我可以在不打开H5文件的情况下通过序列化(点刺)创建的保存文件中存储H5文件吗?

I have a HDF5 file and a list of objects that I need to store for saving functionality. For simplicity I want to create only one save file. Can I store H5 file, in my save file that I create with serialization (pickle) without opening H5 file.

推荐答案

您可以使用 zip文件 tarfile

  • 对于zipfile,您将write数据库文件和writestr您的pickle.dumps ed数据.
  • 对于tarfile,您将add数据库文件和gettarinfoaddfile您的pickle.dump数据从文件中删除.
  • for zipfile you would write the database files and writestr your pickle.dumpsed data.
  • for tarfile you would add the database file and gettarinfo, addfile your pickle.dumped data from a file.

如果您不需要扩展的文件系统属性,我建议您创建一个zip,因为它更易于使用.

I would suggest creating a zip if you do not need extended filesystem-attributes because it is a bit easier to use.

这篇关于我可以通过序列化将文件(HDF5文件)存储在另一个文件中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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