问题
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.
回答1:
You can put several files in one by using zipfile or tarfile
- for zipfile you would
write
the database files andwritestr
yourpickle.dumps
ed data. - for tarfile you would
add
the database file andgettarinfo
,addfile
yourpickle.dump
ed data from a file.
I would suggest creating a zip if you do not need extended filesystem-attributes because it is a bit easier to use.
来源:https://stackoverflow.com/questions/39369671/can-i-store-a-file-hdf5-file-in-another-file-with-serialization