您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在Python中读取HDF5文件

如何在Python中读取HDF5文件

import h5py
filename = "file.hdf5"

with h5py.File(filename, "r") as f:
    # List all groups
    print("Keys: %s" % f.keys())
    a_group_key = list(f.keys())[0]

    # Get the data
    data = list(f[a_group_key])
import h5py

# Create random data
import numpy as np
data_matrix = np.random.uniform(-1, 1, size=(10, 3))

# Write data to HDF5
with h5py.File("file.hdf5", "w") as data_file:
    data_file.create_dataset("group_name", data=data_matrix)

有关更多信息,请参见h5py docs

XML:存在太多叹息与写 对于您的应用程序,以下内容可能很重要:

其他编程语言的支持

另请参阅:数据序列化格式的比较

如果您想寻找一种制作配置文件方法,则可能需要阅读我的短文《Python中的配置文件》。

python 2022/1/1 18:48:09 有349人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶