简体   繁体   English

H5十六进制数据

[英]H5 Hexadecimal data

When I load a .h5 file into the spyder environment using h5py, I no longer see the hexadecimal data that was in the original file. 当我使用h5py将.h5文件加载到spyder环境中时,不再看到原始文件中的十六进制数据。

Does Python convert the hex information to uint8 automatically? Python是否将十六进制信息自动转换为uint8?

HDF5 does not store hexadecimal data, only numbers and characters. HDF5不存储十六进制数据,仅存储数字和字符。 The documentation of HDF5 lists the supported datatypes. HDF5文档列出了支持的数据类型。

What you interpret as hexadecimal data is very likely integer data. 您解释为十六进制数据的很可能是整数数据。 You can have a look at the datatypes in your file by typing 您可以通过键入以下内容来查看文件中的数据类型

h5dump -A filename.h5

The -A flag means: list the attributes (ie the metadata). -A标志的意思是:列出属性(即元数据)。 You can look at a part of the file with 您可以使用以下命令查看文件的一部分

h5dump -A -g name_of_a_group filename.h5

Python will probably convert those values to int32. Python可能会将这些值转换为int32。 Use hex() to see those values in hexadecimal form, and use bitwise operations for manipulation. 使用hex()以十六进制形式查看那些值,并使用按位运算进行操作。 You can also use bin() to see things in binary 您还可以使用bin()以二进制形式查看内容

hex(2) '0x2'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM